[Freeswitch-users] collecting dtmf digits

Sam u2nsam at gmail.com
Sat Dec 18 08:10:32 MSK 2010


If i a get a hangup cause into some variable then i can do some routing
depending upon that hangup-cause,

if (session:ready()) then

session:streamFile("/usr/local/freeswitch/sounds/en/us/callie/zrtp/8000/zrtp-somethings_wrong.wav")

    disposition = session:getVariable("hangup_cause")
    freeswitch.consoleLog("info","Hangup cause = " .. disposition .. "\n")
    disposition = session:hangupCause()
    freeswitch.consoleLog("info","Hangup cause = " .. disposition .. "\n")

then using the "disposition" i can do the routing by if ... then ...

after executing getting below logs :-

2010-12-18 10:34:55.581403 [ERR] mod_lua.cpp:182
/usr/local/freeswitch/scripts/hello.lua:29: attempt to concatenate global
'disposition' (a nil value)
stack traceback:
        /usr/local/freeswitch/scripts/hello.lua:29: in main chunk


Regds
Sam

On Sat, Dec 18, 2010 at 6:26 AM, mercutioviz [via freeswitch-users] <
ml-node+5847277-1438596481-292429 at n2.nabble.com<ml-node%2B5847277-1438596481-292429 at n2.nabble.com>
> wrote:

> It depends on what you want to do with the call in the case that the other
> end does not answer. If you are doing some sort of billing then STOP! Don't
> do that. Do your billing offline via CDRs or use api_hangup_hook.
>
> If you just want to send the call to an alternate destination then you need
> to look at the bridge app on the wiki, specifically for doing pipe-separated
> lists of dialstrings:
> http://wiki.freeswitch.org/wiki/Misc._Dialplan_Tools_bridge#Description
>
> -MC
>
> On Fri, Dec 17, 2010 at 2:17 AM, Sam <[hidden email]<http://user/SendEmail.jtp?type=node&node=5847277&i=0>
> > wrote:
>
>> Thanx Nazim it was of great help,
>>
>> i used the below syntax
>>
>>
>> session:execute("bridge",(string.format("{ignore_early_media='true',continue_on_fail='true'}sofia/external/%[hidden
>> email] <http://user/SendEmail.jtp?type=node&node=5847277&i=1>",tostring(digits)
>> )) ) ;
>>
>>
>> I am now checking out if i can use hangup causes for routing the call
>>
>> LCause = session:hangupCause() ;
>>
>> freeswitch.consoleLog("info", "hangupcause: ".. LCause .." );
>>
>> then if i can use if then else statement for routing ... like
>>
>> if ( LCause == "NO_USER_RESPONSE" ) then
>>        session:transfer(tostring(digits), "XML", "8888")
>>
>> how is the idea ?
>>
>> Regds
>>
>>
>>
>>
>> On Fri, Dec 17, 2010 at 2:39 PM, Nazim Aghabayov <[hidden email]<http://user/SendEmail.jtp?type=node&node=5847277&i=2>
>> > wrote:
>>
>>> Hello! You may try something like:
>>>
>>>  session:execute("bridge",
>>>                            (string.format("{ignore_early_media='true',
>>> ringback='home/app/sounds/ringback-alaw.wav',
>>> transfer_ringback='/home/app/sounds/ringback-alaw.wav',
>>> hangup_after_bridge='true',
>>> continue_on_fail='true'}[hidden email]<http://user/SendEmail.jtp?type=node&node=5847277&i=3>
>>> ",
>>>
>>>                                           tostring(did) )) )
>>>
>>> There are a lot of nice examples in lua&dialplan wiki pages.
>>>
>>> On 12/17/2010 12:24 PM, David Ponzone wrote:
>>> > You need to read the wiki intensively, and also, Internet is a very
>>> useful source of information to learn LUA.
>>> >
>>> > David Ponzone  Direction Technique
>>> > email: [hidden email]<http://user/SendEmail.jtp?type=node&node=5847277&i=4>
>>>
>>> > tel:      01 74 03 18 97
>>> > gsm:   06 66 98 76 34
>>> >
>>> > Service Client IPeva
>>> > tel:      0811 46 26 26
>>> > www.ipeva.fr  -   www.ipeva-studio.com
>>> >
>>> > Ce message et toutes les pièces jointes sont confidentiels et établis à
>>> l'intention exclusive de ses destinataires. Toute utilisation ou diffusion
>>> non autorisée est interdite. Tout message électronique est susceptible
>>> d'altération. IPeva décline toute responsabilité au titre de ce message s'il
>>> a été altéré, déformé ou falsifié. Si vous n'êtes pas destinataire de ce
>>> message, merci de le détruire immédiatement et d'avertir l'expéditeur.
>>> >
>>> >
>>> >
>>> >
>>> > Le 17/12/2010 à 09:07, samir a écrit :
>>> >
>>> >> Hello Nazim,
>>> >>
>>> >> When i use originate command it gives me below error :-
>>> >>
>>> >> 2010-12-17 13:29:30.964039 [ERR] mod_lua.cpp:182 Error in originate
>>> expected 4..4 args, got 1
>>> >> stack traceback:
>>> >>         [C]: in function 'originate'
>>> >>         /usr/local/freeswitch/scripts/hello.lua:14: in main chunk
>>> >>
>>> >> I am using
>>> >>
>>> >> digits = session:getDigits(5, "#", 3000);
>>> >> freeswitch.consoleLog("info", "Got dtmf: ".. digits .."\n");
>>> >> session.originate("sofia/external/(digits)@192.168.2.3");
>>> >>
>>> >>
>>> >> any idea why is it ?
>>> >>
>>> >> Regards
>>> >> Sam
>>> >>
>>> >>
>>> >> On Fri, Dec 17, 2010 at 4:17 AM, Nazim Aghabayov [via
>>> freeswitch-users] <[hidden email]> wrote:
>>> >> Why not using Lua script? Lua is quite powerful and you could benefit
>>> of
>>> >> using the luasql for db connectivity.
>>> >>
>>> >> g_caller_id = session:getVariable("caller_id_number")
>>> >> g_caller_destination_number =
>>> session:getVariable("destination_number")
>>> >> g_caller_context = session:getVariable("context")
>>> >> g_caller_uuid = session:getVariable("uuid")
>>> >> ...
>>> >> session:flushDigits()
>>> >> digits = session:playAndGetDigits(4, 4, 3, 3000, "#",
>>> >>               wav_base .. langId .. "/" .. prompt_wav, "",
>>> >>       "[" .. allowed_digit1 .. "," .. allowed_digitN .. "]");
>>> >> ...
>>> >> session:transfer(tostring(dest_ext), "XML", "public")
>>> >>
>>> >> Regards,
>>> >> Nazim
>>> >>
>>> >>
>>> >> On 12/16/2010 07:29 AM, Sam wrote:
>>> >>
>>> >>> hi,
>>> >>>
>>> >>> Its not an XML IVR but trying to collect digits when the user punches
>>> in
>>> >>> some digits after a playback sound file,
>>> >>> so that the digits would get stored into $(digits) and i can use
>>> those
>>> >>> digits for further processing or transferring
>>> >>> to other dial-plan as per the digits punched in.
>>> >>>
>>> >>> Suppose a digits punched are 4567, I collect them in $(digits) and by
>>> >>> transfer function i do the transfer.
>>> >>>
>>> >>> <action application="transfer" data="$(digits) default XML"/>
>>> >>>
>>> >>>
>>> -----------------------------------------------------------------------------------------------
>>> >>>
>>> >>> Also i could see that in IVR.conf can do this by pressing 4567 and
>>> executing
>>> >>> a statement , but here also question
>>> >>> is how can i use it by storing those collected digits in an variable
>>> and the
>>> >>> using it further.
>>> >>>
>>> >>>
>>> ----------------------------------------------------------------------------------------------
>>> >>>
>>> >>> I was thinking how in both the cases it could be done.
>>> >>>
>>> >>> Thnx & Regds
>>> >>> Sam
>>> >>>
>>> >>>
>>> >>>
>>> >>> On Thu, Dec 16, 2010 at 4:35 AM, Michael Collins <[hidden email]>
>>> wrote:
>>> >>>
>>> >>>> Is this an XML IVR?
>>> >>>> -MC
>>> >>>>
>>> >>>>
>>> >>>> On Tue, Dec 14, 2010 at 1:43 AM, samir <[hidden email]> wrote:
>>> >>>>> hello,
>>> >>>>>
>>> >>>>> Is there any method to collect digits by a variable clause ?
>>> >>>>>
>>> >>>>> Suppose i have a ivr playing and user inputs digits , i want to
>>> collect
>>> >>>>> the
>>> >>>>> dtmf digits and send it to a different application where that
>>> digits will
>>> >>>>> be
>>> >>>>> used for routing purpose.
>>> >>>>>
>>> >>>>> Any ideas !
>>> >>>>>
>>> >>>>> Regards
>>> >>>>> Sam
>>> >>>>> --
>>> >>>>> View this message in context:
>>> >>>>>
>>> http://freeswitch-users.2379917.n2.nabble.com/collecting-dtmf-digits-tp5833942p5833942.html<http://freeswitch-users.2379917.n2.nabble.com/collecting-dtmf-digits-tp5833942p5833942.html?by-user=t>
>>> >>>>> Sent from the freeswitch-users mailing list archive at Nabble.com.
>>> >>>>>
>>> >>>>> _______________________________________________
>>> >>>>> FreeSWITCH-users mailing list
>>> >>>>> [hidden email]
>>> >>>>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>>> >>>>> UNSUBSCRIBE:
>>> http://lists.freeswitch.org/mailman/options/freeswitch-users
>>> >>>>> http://www.freeswitch.org
>>> >>>>>
>>> >>>> _______________________________________________
>>> >>>> FreeSWITCH-users mailing list
>>> >>>> [hidden email]
>>> >>>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>>> >>>> UNSUBSCRIBE:
>>> http://lists.freeswitch.org/mailman/options/freeswitch-users
>>> >>>> http://www.freeswitch.org
>>> >>>>
>>> >>>>
>>> >>>
>>> >>> _______________________________________________
>>> >>> FreeSWITCH-users mailing list
>>> >>> [hidden email]
>>> >>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>>> >>> UNSUBSCRIBE:
>>> http://lists.freeswitch.org/mailman/options/freeswitch-users
>>> >>> http://www.freeswitch.org
>>> >>
>>> >> _______________________________________________
>>> >> FreeSWITCH-users mailing list
>>> >> [hidden email]
>>> >> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>>> >> UNSUBSCRIBE:
>>> http://lists.freeswitch.org/mailman/options/freeswitch-users
>>> >> http://www.freeswitch.org
>>> >>
>>> >>
>>> >> View message @
>>> http://freeswitch-users.2379917.n2.nabble.com/collecting-dtmf-digits-tp5833942p5843837.html<http://freeswitch-users.2379917.n2.nabble.com/collecting-dtmf-digits-tp5833942p5843837.html?by-user=t>
>>> >>
>>> >> To unsubscribe from collecting dtmf digits, click here.
>>> >>
>>> >>
>>> >> View this message in context: Re: collecting dtmf digits
>>> >> Sent from the freeswitch-users mailing list archive at Nabble.com.
>>> >> _______________________________________________
>>> >> FreeSWITCH-users mailing list
>>> >> [hidden email] <http://user/SendEmail.jtp?type=node&node=5847277&i=5>
>>> >> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>>> >> UNSUBSCRIBE:
>>> http://lists.freeswitch.org/mailman/options/freeswitch-users
>>> >> http://www.freeswitch.org
>>> >
>>> >
>>> > _______________________________________________
>>> > FreeSWITCH-users mailing list
>>> > [hidden email] <http://user/SendEmail.jtp?type=node&node=5847277&i=6>
>>> > http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>>> > UNSUBSCRIBE:
>>> http://lists.freeswitch.org/mailman/options/freeswitch-users
>>> > http://www.freeswitch.org
>>>
>>>
>>> _______________________________________________
>>> FreeSWITCH-users mailing list
>>> [hidden email] <http://user/SendEmail.jtp?type=node&node=5847277&i=7>
>>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>>> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
>>> http://www.freeswitch.org
>>>
>>
>>
>> _______________________________________________
>> FreeSWITCH-users mailing list
>> [hidden email] <http://user/SendEmail.jtp?type=node&node=5847277&i=8>
>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
>> http://www.freeswitch.org
>>
>>
>
> _______________________________________________
> FreeSWITCH-users mailing list
> [hidden email] <http://user/SendEmail.jtp?type=node&node=5847277&i=9>
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org
>
>
> ------------------------------
>  View message @
> http://freeswitch-users.2379917.n2.nabble.com/collecting-dtmf-digits-tp5833942p5847277.html
>
> To unsubscribe from collecting dtmf digits, click here<http://freeswitch-users.2379917.n2.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5833942&code=dTJuc2FtQGdtYWlsLmNvbXw1ODMzOTQyfC0xMTk1MzYwMDk5>.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20101218/15c26d1c/attachment-0001.html 


More information about the FreeSWITCH-users mailing list