Author Topic: simple sip phone dial  (Read 18574 times)

marian

  • Hero Member
  • *****
  • Posts: 513
    • View Profile
Re: simple sip phone dial
« Reply #15 on: December 09, 2014, 02:55:40 AM »
If you set the 'line' parameter the call will fail (I suppose you don't have a line '100' registered to another server).
NOTE: If you want to call on a different path a busy target you should be aware you might call again to someone that rejected the call!

If you want to fallback to another target use fork.
See http://docs.yate.ro/wiki/Call_Forker

The handler should look like this:

if ($ev->getValue("called")=="100") {
  $ev->retval = "fork";
  $ev->params["callto.1"] = $location;
  $ev->params["callto.2"] = "|";
  $ev->params["callto.3"] = PUT_HERE_THE_SECOND_TARGET;
  $ev->params["callto.1.maxcall"] = PUT_HERE_MAX_CALLING_TIME_IN_MILISECONDS;
  $ev->params["stoperror"] = "noanswer|busy^";
  $ev->params[""] = ;
  $ev->handled = true;
  $ev->Acknowledge();
  break;
}

jehanzaib_kiani

  • Newbie
  • *
  • Posts: 45
    • View Profile
Re: simple sip phone dial
« Reply #16 on: December 09, 2014, 05:50:36 PM »
so i changed it to below. and my 100phone rang for 20 seconds then it just hangup saying Temporarily unavailable.  it did not try on my second server after the timeout. you might be able to figure out from the attached logs. by the way i am dialing from 100 to 100.

 $ev->retval = "fork";
  $ev->params["callto.1"] = "sip/sip:100@xx.xx.xx.xx:6542";
  $ev->params["callto.2"] = "|";
  $ev->params["callto.3"] = "sip/sip:100@mysecondserver.com";
  $ev->params["callto.1.maxcall"] = 20000;
  $ev->params["stoperror"] = "noanswer|busy^";
  $ev->handled = true;
  $ev->Acknowledge();
  break;

marian

  • Hero Member
  • *****
  • Posts: 513
    • View Profile
Re: simple sip phone dial
« Reply #17 on: December 10, 2014, 01:42:09 AM »
Sorry, bad regexp (| char must be escaped), set stoperror:
$ev->params["stoperror"] = "noanswer\|busy^";

Also replace 'stoperror' (obsolete) with new 'fork.stop':
$ev->params["fork.stop"] = "noanswer\|busy^";