I was successfully able to execute the PJSIP_DIAL_CONTACTS(PJSIP/123) command from the dialplan. Now I’m trying to do the equivalent from the AMI. I’ve opened a telnet session, logged in, and typed the following command;
This does not report any error, but returns an empty variable. I realize there is an action called PJSIPShowContacts but that returns all contacts, which I would prefer not to have to sort through.
If I could find the equivalent CLI command I could use the “action:command” parameter in the AMI. Is there a comparable CLI command? And worst case, if not, is it possible to get this information from the ARI? At the time I want to get this information there is no channel, so I can’t use the ARI’s getChannelVar function. I tried the following:
There is a difference between getting a variable value and making a phone call. The GetVar action retrieves the value of a channel variable or function return; it won’t start any call and also won’t retrieve any value in the way you are using it. If you want to start a call, use AMI and a local channel.
This is the most used and effective way to start a call using AMI.
I’m not trying to start a call, I’m just trying to lookup the contact string for a PJSIP extension. I have 3 devices registering on the same username/extension, so this PJSIP_DIAL_CONTACTS function gives me a string with the full URI of each device.
Dial(${PJSIP_DIAL_CONTACTS(${EXTEN})}) To dial all the contacts associated with the endpoint, use the PJSIP_DIAL_CONTACTS() function
I If this function returns any specific channel variable or contact list, I have never seen any documentation about it. Try using DumpChan() to see if there is a variable with the value you need.
The dialplan interpreter is basically a text macro processor. When you call a dialplan function, ignoring any side effects, it simply returns a string, that you could have entered explicitly. This function just returns multiple dialstrings, separated by & in the same way as you would use & to construct an arbitrary set of destinations for simultaneous dialling.
I’m trying to get a list of all of the endpoints which have registered to a particular extension in PJSIP. I my case I have 3 phones all registered using extensions 123. If I originate a call to PJSIP/123 only one of them rings (per a different post).
Pjcolp suggesting using the PJSIP_DIAL_CONTACTS function to get a list of all of the URI’s to which I must connect. I tried this from within the dialplan and it works great. I split the returned string at & and I had 3 perfectly formatted URI’s to call my three phones!
Now I want to do this from the AMI, but there seems to be no way to call the PJSIP_DIAL_CONTACTS function from the AMI. There is an AMI command to list ALL endpoints, which buried in that output is the contact URI for each endpoint…but that’s a lot more work. I’m hoping to just call the PJSIP_DIAL_CONTACTS function from the AMI, but can’t figure out how.
There is no call in progress so no channel available…so can’t call that function. (This is AMI specific). I tried using the similar global variable command but it did not work.