[Freeswitch-users] DTMF javasript

Michael Jerris mike at jerris.com
Tue Nov 24 00:41:25 PST 2009


Your not telling anything to call your callback.

On Nov 24, 2009, at 1:03 AM, Baskar wrote:

>  Hi,
> 
> I want to check value given to the javascript with conditions whether it is voicefile, extension  or mobile Number when i press the dtmf value.
> 
> Steps i need to check in javascript:
> 
> When i Press the DTMF value 1 it should check the 3 condition
> 
> If the Value for argv[2]=vfsurya means it is a voice file so it should play the Voice file
> If the Value for argv[2]=1001 means it is a extension. The call should Bridge the extension
> If the Value for argv[2]=9841799874 means it is a Mobile number. The call should Bridge  the Mobile number
> 
> var exit = false;
> var dtmf_digits = "";
> var repeat = 0;
> var argv[2]=vfsurya;  // or var argv[2]=1001  or var argv[2]=Mobile Number
> 
> 
> function onInput( session, type, data, arg ) 
> {
>   if ( type == "dtmf" ) 
>   {
>     console_log( "info", "Got digit " + data.digit + "\n" );
>     if ( data.digit == "1" ) 
> 	{
>         if(argv[2].startswith("vf"))
> 		{
> 			var voice2=voice.substring(2)+"<br />"
> 			session.streamFile("/usr/local/freeswitch/sounds/en/us/callie/"+voice2+".wav", onInput );
> 		}
> 		else if(argv[2].length==4)
> 		{
> 			console_log( "info", "Got voicefile " + argv[2] + "\n" );
> 			session.execute("bridge", "sofia/internal/"+argv[2]+"%192.168.1.2", onInput ); 
> 		}
> 		else
> 		{
> 			session.execute("bridge", "sofia/default/sip:"+argv[2]+"@192.168.1.135:5066", onInput ); 
> 		}
>         }
>     }
> }
> 
> But if 1 is pressed there is no event trigger but it get the dtmf value as 1 in freeswitch console. 
> 
> can any one specify what is the error or correct me where i am wrong.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20091124/70af6ed1/attachment-0002.html 


More information about the FreeSWITCH-users mailing list