Author Topic: How to make calls from IVR to external phone number (PHP)  (Read 2575 times)

jonathanv@rokk3rlabs.com

  • Newbie
  • *
  • Posts: 5
    • View Profile
How to make calls from IVR to external phone number (PHP)
« on: March 03, 2015, 04:33:34 PM »
We found the following information related to how make call from IVR to external phone number:

- http://yate.null.ro/archive/?action=show_msg&actionargs%5B%5D=53&actionargs%5B%5D=53
- http://yate.null.ro/archive/?action=show_msg&actionargs%5B%5D=58&actionargs%5B%5D=14

We already made the changes mentioned in the links, but they are not working and they are not showing any logs information.
We create the following function to call.
Code: [Select]
function MakeCall($route) {
        global $saved_ev;
        $called = $saved_ev->GetValue("sip_from");
        $partycallid = $saved_ev->GetValue("id");

        $m = new Yate("chan.masquerade");
        $m->params = $saved_ev->params;
        $m->params["message"] = "call.execute";
        $m->params["callto"] = "5717455171";
        $m->params["id"] = $partycallid;

        $m->Dispatch();
}

Can you help us with any ideas to resolve this, thanks in advance

Monica Tepelus

  • Administrator
  • Full Member
  • *****
  • Posts: 159
    • View Profile
Re: How to make calls from IVR to external phone number (PHP)
« Reply #1 on: March 04, 2015, 04:22:36 AM »
Hi,

Callto is the resource to call not the phone number.
Ex: callto = sip/sip:404040@ip.port not just 404040. If you don't have this info in the script then you must send a call.route message and set in callto the retval of that message if it was handled.

To have logs: use "sniffer on" from telnet console.

jonathanv@rokk3rlabs.com

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: How to make calls from IVR to external phone number (PHP)
« Reply #2 on: March 04, 2015, 05:21:53 PM »
Hi Monica, We try this option but not works .. other idea ? sorry but We need this functionality urgently, Thanks Monica....

Monica Tepelus

  • Administrator
  • Full Member
  • *****
  • Posts: 159
    • View Profile
Re: How to make calls from IVR to external phone number (PHP)
« Reply #3 on: March 05, 2015, 02:38:09 AM »
Hi,

Please paste the relevant code a sniffer log.

Monica Tepelus

  • Administrator
  • Full Member
  • *****
  • Posts: 159
    • View Profile
Re: How to make calls from IVR to external phone number (PHP)
« Reply #4 on: March 05, 2015, 09:01:58 AM »

jonathanv@rokk3rlabs.com

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: How to make calls from IVR to external phone number (PHP)
« Reply #5 on: March 05, 2015, 09:51:43 AM »
Script:

function MakeCall() {
        global $saved_ev;
        global $partycallid;

        $called = $saved_ev->GetValue("sip_uri");
        $this->log->set(" partycallid -------> : " . $partycallid . "\n");

        $m = new Yate("chan.masquerade");

        $m->params = $saved_ev->params;

        $m->params["message"] = "call.execute";
        $route = "line/+5717455171";

        $m->params["callto"] = $called; //"sip:5717455171@104.130.240.10"; //sip:5717455171@104.130.240.10
        $m->params["id"] = $partycallid;
        $m->params["line"] = "sapo";

        $this->log->set(" params -------> : " . var_export($m, true) . "\n");
        $m->Dispatch();
}


Log:
IVR::InitIVR()
login::OnEnter('')
login::OnEvent(incoming 'call.execute')
login::OnMessage('call.execute')
login::SetState('Welcome')
login::OnExecute()
login: Found table operation 'answered'
login::OnEvent(installed 'chan.dtmf')
login::OnEvent(setlocal 'id')
login::OnSetting('id','ivr/39518406654f8771a663351.72944684',true)
login::OnEvent(installed 'chan.dtmf')
login::OnEvent(installed 'chan.notify')
20150305153405.432564 <sip:WARN> SIP line 'sapo' logon failure 401: Unauthorized
20150305153906.394980 <sip:WARN> SIP line 'sapo' logon failure 401: Unauthorized

accfile.conf:

[sapo]
enabled=yes
protocol=sip
username=+57174551**
description=CLIENT SIP
;interval=600
formats=ulaw
authname=+57174551**
password=
number=+57174551**
-- I'm not sure this configuration ---
domain=voip.sapo.pt
registrar=voip.sapo.pt:5070
outbound=proxy.voip.sapo.pt
-----
localaddress=auto


regexroute.conf:
^\+571.*$=sip/sip:;line=sapo;caller=+57174551**

« Last Edit: March 05, 2015, 10:12:09 AM by jonathanv@rokk3rlabs.com »

jonathanv@rokk3rlabs.com

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: How to make calls from IVR to external phone number (PHP)
« Reply #6 on: March 05, 2015, 02:09:48 PM »
I change
yate.conf  --> modload=no. and the IVR not work  ???

Ioana Stanciu

  • Jr. Member
  • **
  • Posts: 57
    • View Profile
Re: How to make calls from IVR to external phone number (PHP)
« Reply #7 on: March 06, 2015, 02:56:43 AM »
Hi,

modload controls loading of modules. When you set it to no, no modules willl be loaded by the YATE engine unles it is specified in the [modules] section. So unless you specified extmodule.yate=yes in the modules section, your script will not load.

If you want a sniffer log, you either have to set 'msgsniff' setting to yes in yate.conf or you can activate it throug telnet through command "sniffer on".

Check these pages:
http://docs.yate.ro/wiki/Debugging_and,_or_Investigation_of_messages
http://docs.yate.ro/wiki/Debugging_in_Yate
http://docs.yate.ro/wiki/Rmanager
« Last Edit: March 06, 2015, 03:05:02 AM by oana »

Monica Tepelus

  • Administrator
  • Full Member
  • *****
  • Posts: 159
    • View Profile
Re: How to make calls from IVR to external phone number (PHP)
« Reply #8 on: March 06, 2015, 06:54:22 AM »
Hi,

Do you want to use the line registered in accfile?

If so see below:

function MakeCall() {
        global $saved_ev;
        global $partycallid;

        $this->log->set(" partycallid -------> : " . $partycallid . "\n");

        $m = new Yate("chan.masquerade");

        $m->params = $saved_ev->params;

        $m->params["message"] = "call.execute";
        $route = "line/+5717455171";
        $m->params["callto"] = $route;
        $m->params["id"] = $partycallid;
        $m->params["line"] = "sapo";

        $this->log->set(" params -------> : " . var_export($m, true) . "\n");
        $m->Dispatch();
}

Also, from your log it seems that line "sapo" is not registered. So make sure it's first registered before sending calls to it.