greenfieldtech-nirs / phpari

A Class Library enabling Asterisk ARI functionality for PHP
GNU Lesser General Public License v2.1
89 stars 56 forks source link

CALLERID(name) does not work, #67

Open wilcarjose opened 5 years ago

wilcarjose commented 5 years ago

Hi @greenfieldtech-nirs I am using the basic StasisAppDial.php example, but It doesn't work when I send "CALLERID(name)" => "test"

Could there be a bug in the library?

$response = $this->phpariObject->channels()->channel_originate(
                        $args[0],
                        NULL,
                        array(
                            "app"     => "stasis-dial",
                            "appArgs" => '',
                            "timeout" => $args[1],
                            "callerId" => '888888888'
                        ),
                        array(
                            "CALLERID(name)" => "test"
                        )
                    );
richilp commented 5 years ago

Hi Nir, to give you more information about this problem, look please to the ari debug:

<--- Sending ARI event to 192.168.0.110:48220 ---> { "type": "ChannelStateChange", "timestamp": "2018-11-29T12:25:45.822+0100", "channel": { "id": "A2-1543490745.338", "name": "PJSIP/ricardo10-0000010b", "state": "Ringing", "caller": { "name": "prueba", "number": "888888888" }, "connected": { "name": "", "number": "888888888" }, "accountcode": "ricardo10", "dialplan": { "context": "prepago-dev", "exten": "s", "priority": 1 }, "creationtime": "2018-11-29T12:25:45.752+0100", "language": "en" }, "asterisk_id": "50:9a:4c:77:e6:41", "application": "stasis-dial" } -- PJSIP/ricardo10-0000010b is ringing -- PJSIP/ricardo10-0000010b is ringing

As you can see we're missing the content of the field "name". So the called part just get the number but not the name when his phone rings. We're using the simple stasis example just to be sure that is nothing regarding our code.

Are we doing something wrong?

Thanks Nir

richilp commented 5 years ago

Here is more readable:

"connected": { "name": "", "number": "888888888" }

richilp commented 5 years ago

Hello Nir,

did you get any chance to check that?. Looks like a little detail, but we haven't found it :(

Thanks

greenfieldtech-nirs commented 5 years ago

Hi Guys,

Sorry for the delay on issues, simply ultra busy with real-life stuff. I'll do my best to attend to this in the next couple of week - while I'm abroad.

Nir S

greenfieldtech-nirs commented 5 years ago

Actually, now that I think about it - I'm not sure PHP will accept "CALLERID(name)" or "anything(anything)" as a valid array index. Interesting for sure.

richilp commented 5 years ago

Hi Nir,

we've been working around this issue.

Yes, PHP accepts anything(anything), we're able to send the variable with all the info.

Eventually we've checked that sending CALLERID(name):

$params = [ "app" => $appname, // incoming "appArgs" => '', "timeout" => $timeout, "callerId" => $callerId, 'context' => $context, ]; $variables = [ 'CALLERID(name)' = 'Ri', } $this->response = $this->ari->channels()->originate( $to, null, $params, $variables );

doesn't work but sending CALLERID(all):

$params = [ "app" => $appname, // incoming "appArgs" => '', "timeout" => $timeout, "callerId" => $callerId, 'context' => $context, ]; $variables = [ 'CALLERID(all)' = 'Ri<999999999>', } $this->response = $this->ari->channels()->originate( $to, null, $params, $variables );

works !!

Does this make sense to you?. For us is more than ok to work that way, but just wondering if this information ring a bell to you.

Thanks for everything Nir ;)