yaai
yaai copied to clipboard
Asterisk extension instead of phone number at outbound calls
asterisk11-11.7.0 yaai 3.6.9
Same problem thats described at https://github.com/blak3r/yaai/issues/43 , but it closed and was year ago. When i make "Click to Dial" it works properly:
But if i make outbound call i see my extension number in "Phone" field.
And because of it this call is not automatically Relate to proper account
Interesting... this has been reported by several people. I have never been able to get anyone to make any progress on it. I cannot reproduce it as I only have 1.6 and 1.8 asterisk boxes available.
Question... do you use A2Billing? Someone else that reported this to me had that. Wondering if there is some correlation.
Here's what I recommend...
Open up callCreate.php
Then look for the code below.
That's the AMI code that actually generates the call. There really aren't that many variables that one could even play with. I'd hardcode the values for each thing until you get it to work... then tell me what you need to put where.
// dial number
fputs($socket, "Action: originate\r\n");
fputs($socket, "Channel: ". $channel ."\r\n");
fputs($socket, "Context: ". $context ."\r\n");
fputs($socket, "Exten: " . $number . "\r\n");
fputs($socket, "Priority: 1\r\n");
fputs($socket, "Callerid:" . $_REQUEST['phoneNr'] ."\r\n");
fputs($socket, "Variable: CALLERID(number)=" . $extension . "\r\n");
fputs($socket, "Action: Logoff\r\n\r\n");
fputs($socket, "\r\n");
Here's an example, it calls extension 61. Once answered it connects to 0821234040
ActionID: 1,
Action: 'Originate',
Channel: 'SIP/61',
Context: 'from-internal',
Exten: '0821234040',
Priority: '1',
CallerID: '0821234040',
Timeout: '20000'
You'll notice that Exten is a phone number and CallerID is identical. Everytime I see this I think that's a bug. But, I assure you that's how it has to be on my boxes at least... As I understand it, Exten is the line to connect to after the channel
answers. And the CallerID just sets the CallerID...
Hmm... I just googled around a bit and found http://dev.villagetelco.org/trac/browser/server/trunk/wwwroot/a2billing/provisioning/originate_echo.php?rev=81
They do it a bit more intuitively... but they're invoking it with a different context. So, maybe that's why.
$channel = "SIP/".$calling_account[0];
$exten = '1234';
$context = '1234@a2billing_echotest';
$priority = 1;
$timeout = 30000;
$async = True;
$callerid = "1234";
echo "--> Trying to Originate call to $channel \n\n";
$res_orig = $as->Originate($channel,
$exten, $context, $priority,
$application=NULL, $data=NULL,
$timeout, $callerid, $variable=NULL, $account=NULL, $async, $actionid=NULL);
print_r ($res_orig);
Good luck!
- No, i dont use A2Billing
- I think some misunderstanding here - originate part of yaai works well, problem with detection of call number in outbound calls - i call (by myself - without originate) to any number and yaai put my number to phone field.
Here you can see output of asteriskLogger.php when i make call. 1102 is my asterisk user, 84952289878 is number i call, but it create call with [asterisk_caller_id_c] => 1102 https://github.com/tatarenko/miscelaneos/blob/master/output.txt
That's weird. Assumed it was a click to dial related. Out of curiosity when you do click to dial does it work properly?
If so then it's probably the context.
Wanna try our new platform out? It's hosted and I built some debugging tools which allow myself and other mere mortals understand how the call events are processed. I'd be interested to see how 11.X commands come in.
Go to https://dashboard.callinize.com/signup
It'll walk you through the setup. Reach out to me at Blake at callinize
Sent via mobile
On Jan 16, 2014, at 9:07 PM, tatarenko [email protected] wrote:
- No, i dont use A2Billing
- I think some misunderstanding here - originate part of yaai works well, problem with detection of call number in outbound calls - i call (by myself - without originate) to any number and yaai put my extension number to phone field.
Here you can see output of asteriskLogger.php when i make call. 1102 is my asterisk user, 84952289878 is number i call, but it create call with [asterisk_caller_id_c] => 1102 https://github.com/tatarenko/miscelaneos/blob/master/output.txt
— Reply to this email directly or view it on GitHub.
- Yes, when i use Click to Dial, i see right number
- Sory, but i dont interesting in any hosted SaaS products
I solved this: (In next examples I - 1102 call to test number 89266100611)
- I made
print_r($e);
Array
(
[Event] => Dial
[Privilege] => call,all
[SubEvent] => Begin
[Channel] => SIP/1102-0000025c
[Destination] => SIP/gsm1-0000025d
[CallerIDNum] => 1102
[CallerIDName] => 1102
[ConnectedLineNum] => <unknown>
[ConnectedLineName] => <unknown>
[UniqueID] => 1389972554.615
[DestUniqueID] => 1389972554.616
[Dialstring] => 89266100611@gsm1
)
- I made
echo "$query"
INSERT INTO asterisk_log (asterisk_id, call_record_id, channel, remote_channel, callstate, direction, CallerID, timestamp_call,user_extension) VALUES('1389972554.615','5c1fead4-a4d1-eee7-fddf-52d94c5d7b9c','SIP/1102-0000025c','SIP/gsm1-0000025d','NeedID','O','1102',FROM_UNIXTIME(1389972554),'1102')
- I make this -
if (!empty($e['Dialstring'])) {
if (preg_match("/(.*?\/)N?(\d+)/", $e['Dialstring'], $ds_matches)) {
$tmpCallerID = $ds_matches[2];
logLine(" CallerID set from Dialstring to: " . $tmpCallerID);
}
+ if (preg_match("/(\d+)@(.*)/", $e['Dialstring'], $ds_matches)) {
+ $tmpCallerID = $ds_matches[1];
+ logLine(" CallerID set from Dialstring to: " . $tmpCallerID);
+ }
}
I dont understand is it good fix or dirty hack (i am not programmer) but now it works