Sending SMS from Asterisk
I have a need to be able to SMS the callerid of some calls, to a mobile phone acting as an out-of-hours contact number. The mobile phone will depend on which night mode is set.
As a test I'm trying this on a spare Trixbox connected to ISDN2e (from BT in the UK) with a Sangoma A500. The method I'm using is a bit of a work in progress, initially I was going to email the CID to the mobile (but this works best if the mobile is a Blackberry or similar).
In extensions_override_freepbx.conf I have:
[app-daynight]
include => app-daynight-custom
exten => 0,1,GotoIf($["${DB(DAYNIGHT/C0)}" = "NIGHT"]?app-daynight,3,1:app-daynight,1,1)
exten => 1,1,GotoIf($["${DB(DAYNIGHT/C1)}" = "NIGHT"]?app-daynight,4,1:app-daynight,2,1)
exten => 2,1,GotoIf($["${DB(DAYNIGHT/C2)}" = "NIGHT"]?app-daynight,5,1:ext-group,600,1)
exten => 3,1,AGI(txt_cid.agi)
exten => 3,2,Goto(from-did-direct,4001,1)
exten => 4,1,AGI(email_cid.agi)
exten => 4,2,Goto(from-did-direct,4002,1)
exten => 5,1,AGI(email_cid.agi)
exten => 5,2,Goto(from-did-direct,4003,1)
; end of [app-daynight]
In txt_cid.agi I have:
#!/usr/bin/php -q
<?php
function debug($string, $level=3) {
global $AGI;
$AGI->verbose($string, $level);
}
//
//
require_once "phpagi.php";
$cidnum = ""; // Caller ID Number for this call
$cidname = ""; // Caller ID Name for this call
$AGI = new AGI();
debug("Starting email_clid.agi", 1);
$message = "Call: " . date("F j, Y, g:i a") . " From: " . $cidnum;
$command1 = "smsq " . $message;
$command2 = "smsq 00000 register";
exec($command2);
//exec($command1);
?>
In the above $command2 is supposed to send the register command to setup BT Text, and once that's worked I'll fix the other parts to send the call time and date.
However in the full asterisk log I get (appears to give up after retry 11):
[Jun 3 11:34:18] VERBOSE[2894] logger.c: -- Attempting call on Local/17094009 for application SMS(0) (Retry 3)
[Jun 3 11:34:18] NOTICE[2894] chan_local.c: No such extension/context 17094009@default creating local channel
[Jun 3 11:34:18] NOTICE[2894] channel.c: Unable to request channel Local/17094009
[Jun 3 11:34:18] NOTICE[2894] pbx_spool.c: Call failed to go through, reason (0) Call Failure (not BUSY, and not NO_ANSWER, maybe Circuit busy or down?)
Anyone come across this before and/or know what I need to do to fix it?


Member Since:
2007-06-27