[asterisk-users] problem to get MWI working

Asghar Mohammad asghar144 at gmail.com
Sun Sep 29 05:41:55 CDT 2013


HI Asmaa,
I don't know how MWI works in Voicemail but as i understand it just create
a .call file and put in /var/spool/asterisk/outgoing and asterisk execute
that file.
i am using similar method for sending fax to from email.

i show you some examples from my php scripts.

1. in voicemail   context
exten =>_X.1,VoicemailMain()
exten =>h,1,exten => h,n,System(/usr/bin/php path to php script
 ${CDR(accountcode)} ${FAXEDNUM} ${CALLERID(num)} ${FAXSTATUS}
${CDR(duration)} ${UNIQUEID} ${CALLCOUNT} ${TIFF})

pass variables to script as you need.
**************************************Part of php************************
2. script do some checks on saved VM of Fax if it is too short or
incomplete just delete it or do want you want.
in script collect variables pass to it.
 $argv;
$accountcode = $argv[1];
$callednum = $argv[2];
$callerid = $argv[3];
$faxstatus = $argv[4];
$billtime = $argv[5];
$unid = $argv[6];
$callcount = $argv[7];
$faxtiff = $argv[8];

Create .call file somewhere but not in /var/spool/asterisk/outgoing

$filename = "path to call file/$accountcode-$unid.call";

Remove old call file with same if any.

system ("rm -f $filename");

Create Contents of file as you need

$Content = "Channel: $providertech/$callednum@$providerip\nCallerID:
$callerid\nWaitTime: 180\nMaxRetries: 0\nRetryTime: 300\nContext:
fax-out\nExtension: $callednum \nArchive: false\nPriority: 1\nSetVar:
SENDER=$callerid \nSetVar: TIFF=$faxtiff \nAccount: $accountcode \nSetVar:
CALLCOUNT=2";

Open file and fill it.

$handle = fopen($filename, 'x+');
fwrite($handle, $Content);
fclose($handle);

if you want execute call file after some delay change timestamp.

system ("touch -d '3 minutes 11 seconds' $filename");

Move file to /var/spool/asterisk/outgoing

Note: don't copy the file but MOVE the file. if you copy the file asterisk
may execute partial file.

system ("/bin/mv $filename /var/spool/asterisk/outgoing");

you can use any scripting language.

Hope this will help you





On Sun, Sep 29, 2013 at 2:01 AM, Asmaa Ahmed <asabatgirl at hotmail.com> wrote:

> Hello,
>
> It looks that I got this in the logs while running the scripts manually by
> mistake, so back to the starting point I can't figure why externnotify
> doesn't run? My target is  to have MWI (Message waiting indicator)
> running.
> Also still can see the debug logs in CLI/asterisk logs even with
> increasing the verbosity and debug level!
>
> Thanks.
>
> --
> _____________________________________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
> New to Asterisk? Join us for a live introductory webinar every Thurs:
>                http://www.asterisk.org/hello
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
>    http://lists.digium.com/mailman/listinfo/asterisk-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20130929/0bf7d23a/attachment.html>


More information about the asterisk-users mailing list