No voice when using AMI originate between two external destinations

Hey all,

I have a piece of PHP script that telnets into Asterisk AMI (FreePBX 13.14) on port 5038 and originates a call between two given external numbers A and B. I have done a few tests and the script seems to work OK. In some of the tests though I noticed that the two channels are established but there is no voice. The call then drops after 30 secs due to no RTP packets.This seems to happen only when B is on a particular network (Telstra is the main telecom provider in Australia). Now I emphasize on that… only when number B is on this network. So for example if A is on that network everything is fine.

I have checked a lot of things too long to list them all here. I even set up another server ground up (on Hyper V) on a physically and logically different network and different host, get exact same issue.Even used asterisk-version-switch to go back to version 11. no joy. Not sure if this is to do with Codec, some network settings, or what?

the main function looks like below:
function callback($sock, $cid1, $cid2, $service_number){
fputs($sock, “Action: Originate\r\n”);
fputs($sock, “Channel: SIP/$route_name/$cid1\r\n”);
fputs($sock, “CallerID: $service_number\r\n”);
fputs($sock, “Context: from-internal\r\n”);
fputs($sock, “Exten: $cid2\r\n”);
fputs($sock, “Priority: 1\r\n”);
}

$cid1 and 2 are basically A and B.
NB - I do not have any extensions set up. Just using Asterisk to make external calls for me.

I hope some one can shed some light on this.

Thanks

I would suggest you actually set up an extension (hardware or software) and see why, I believe you probably set up the trunk or router incorrectly, many helpful posts here for one-way audio. . . . (there is a search button at the top of this page :wink: )

1 Like

Dicko thanks for your reply. Trust me I spent over a month on this. I actually noticed today that when I enable a password on my out-band route, it works with no issues!! but as soon as I disable the password no voice again.
I do have an extension as well. Problem is I do not have this issue for extensions.

1 Like

Thanks Igaetz, but that did not fix the issue. I am testing this on two separate FreePBX machines now. Any more ideas?

Having a similar issue with AMI calling from chrome using Jolt click to call extension. All phones work fine when dialing from phone but with AMI script (similar to yours) I get no outbound audio about 80% of the time, about 20% of the time I do get 2 way audio, I have tried multiple versions of asterisk recently seems to be completely random. Did you ever figure this out?