Koozali.org: home of the SME Server

click-to-call and egroupware [DONE]

Offline sonoracomm

  • *
  • 208
  • +0/-0
    • http://www.sonoracomm.com
Re: click-to-call and egroupware [DONE]
« Reply #30 on: April 18, 2008, 09:30:57 PM »
Hello again,

Sorry to be a pain...

I think there must be a bug in the script.  No matter which context (internal) or 'cluster' (default) I use in the custom database field, the pop-up does not display an "Originating number" and it always uses the wrong trunk to dial out on.  It does not use the normal outbound trunk selection and I need it to dial out on a ZAP trunk like normal outbound calls.

Unfortunately, no matter how hard I stare at the script, I don't understand how it actually sends the dialing commands to Asterisk.

Might the problem be due to the empty "Originating number"?

Here is the Asterisk console output:

Code: [Select]
  == Parsing '/etc/asterisk/manager.conf': Found
  == Manager 'remote_mgr' logged on from 192.168.0.1
       > Channel SIP/4101-0980f6c0 was answered.
  == Manager 'remote_mgr' logged off from 192.168.0.1
    -- Executing [5206611293@internal:1] AGI("SIP/4101-0980f6c0", "selintra|OutCluster|5206611293") in new stack
    -- Launched AGI Script /var/lib/asterisk/agi-bin/selintra
    -- AGI Script selintra completed, returning 0
    -- Executing [5206611293@default:1] Set("SIP/4101-0980f6c0", "CALLERID(name)=Sonora Comm") in new stack
    -- Executing [5206611293@default:2] AGI("SIP/4101-0980f6c0", "selintra|OutTrunk|west.voipjet.com") in new stack
    -- Launched AGI Script /var/lib/asterisk/agi-bin/selintra
    -- AGI Script Executing Application: (Dial) Options: (IAX2/7823@voipjet/15206611293)
    -- Called 7823@voipjet/15206611293
    -- Call accepted by 8.3.22.250 (format ulaw)
    -- Format for call is ulaw
    -- IAX2/voipjet-4 is making progress passing it to SIP/4101-0980f6c0
    -- IAX2/voipjet-4 answered SIP/4101-0980f6c0
    -- Hungup 'IAX2/voipjet-4'
  == Spawn extension (default, 5206611293, 2) exited non-zero on 'SIP/4101-0980f6c0'
    -- Executing [h@default:1] Hangup("SIP/4101-0980f6c0", "") in new stack
  == Spawn extension (default, h, 1) exited non-zero on 'SIP/4101-0980f6c0'

And here is the pop-up:

Code: [Select]
Extension SIP/4101
Number 5206611293
Username admin
Originating number
Close this window

I believe the communication with the mysql server and Asterisk are working properly.  I suspect the problem is in the dialing commands being sent to Asterisk.

Thanks much,

G

Offline soprom

  • *
  • 589
  • +0/-0
    • www.logiciel-libre.org
Re: click-to-call and egroupware [DONE]
« Reply #31 on: April 18, 2008, 10:04:59 PM »
I wish I could help you right away but it will have to be later this weekend.
In the mean time, can you tell me if your extension rings and if your hear your extension dialing something when your pick it up?

And what is the phone number associated with the account "admin' in egroupware? Would it be empty?

The custom field in egroupware's addressbook should be looking like
default|SIP/4101
« Last Edit: April 19, 2008, 01:20:32 AM by soprom »
Sophie from Montréal

Offline soprom

  • *
  • 589
  • +0/-0
    • www.logiciel-libre.org
Re: click-to-call and egroupware [DONE]
« Reply #32 on: April 19, 2008, 01:18:11 AM »
From the log, it seems that the script worked since the extension was answered and the call was initiated. I can't say if the script or the pbx is to be investigated first.

The "originating number" is not use by asterisk, just displayed in the popup.

Are you using any cluster at all? Choosing a specific trunk to dialout is not done in the script. It must be in the extension and route config I think.


Notes about dialing. Dialing is done with this:

First the login...
Code: [Select]
$oSocket = fsockopen($strHost, 5038, $errnum, $errdesc) or die("Connection to PBX failed");
fputs($oSocket, "Action: login\r\n");
fputs($oSocket, "Events: off\r\n");
fputs($oSocket, "Username: $strUser\r\n");
fputs($oSocket, "Secret: $strSecret\r\n\r\n");

then calling the extension (like SIP/5000)...

Code: [Select]
fputs($oSocket, "Action: originate\r\n");
fputs($oSocket, "Channel: $strChannel\r\n");
fputs($oSocket, "WaitTime: $strWaitTime\r\n");

finaly, calling the number using a context...

Code: [Select]
fputs($oSocket, "CallerId: $strCallerId\r\n");
fputs($oSocket, "Exten: $strExten\r\n");
fputs($oSocket, "Context: $strContext\r\n");
fputs($oSocket, "Priority: $strPriority\r\n\r\n");
fputs($oSocket, "Action: Logoff\r\n\r\n");
sleep(2);
fclose($oSocket);

In fact, in its simple form, sending parameters and action code followed by 2 empty lines ("\r\n\r\n") is interpreted in asterisk as a command and the PBX executes the command.

« Last Edit: April 19, 2008, 01:51:30 AM by soprom »
Sophie from Montréal