[Freeswitch-users] long DTMF

Tihomir Culjaga tculjaga at gmail.com
Fri Aug 27 02:03:19 PDT 2010


as usual we are alone here ...
I just lost my patience and did it directly in code!


Once rewriting according to FS requirements done , will provide a patch if
anyone interested.



-----------------<-snip->-----------------------
        /*it's hardcoded but who cares at that point :))*/
        if (dtmf->digit == '#') {
              int ok = 0;
              *digit = dtmf->digit;
              dval = atoi(digit);
              dval=0; /* temporary fake the bind key */
              if (direction == SWITCH_DTMF_RECV &&
(md->sr[direction].map[dval].bind_flags & SBF_DIAL_ALEG)) {
                                ok = 1;
              } else if (direction == SWITCH_DTMF_SEND &&
(md->sr[direction].map[dval].bind_flags & SBF_DIAL_BLEG)) {
                                ok = 1;
                        }

                        if (ok && md->sr[direction].map[dval].app) {
                                uint32_t flags =
md->sr[direction].map[dval].flags;

                                if ((md->sr[direction].map[dval].bind_flags
&
                                SBF_EXEC_OPPOSITE)) { if (direction ==
                                SWITCH_DTMF_SEND) { flags |= SMF_ECHO_ALEG;
}
                                else { flags |= SMF_ECHO_BLEG; } } else if
((md-
                                >sr[direction].map[dval].bind_flags &
                                SBF_EXEC_SAME)) { if (direction ==
                                SWITCH_DTMF_SEND) { flags |= SMF_ECHO_BLEG;
}
                                else { flags |= SMF_ECHO_ALEG; } } else if
((md-
                                >sr[direction].map[dval].bind_flags &
                                SBF_EXEC_ALEG)) { flags |= SMF_ECHO_ALEG; }
else
                                if ((md->sr[direction].map[dval].bind_flags
&
                                SBF_EXEC_BLEG)) { flags |= SMF_ECHO_BLEG; }
else
                                { flags |= SMF_ECHO_ALEG; }

                                if ((md->sr[direction].map[dval].bind_flags
& SBF_EXEC_INLINE)) {
                                        flags |= SMF_EXEC_INLINE;
                                }


switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s
Processing meta digit '%c' [%s]\n",

switch_channel_get_name(channel), dtmf->digit,
md->sr[direction].map[dval].app);

                                if (switch_channel_test_flag(channel,
CF_PROXY_MODE)) {
                                        broadcast_in_thread(session,
md->sr[direction].map[dval].app, flags | SMF_REBRIDGE);
                                } else {

switch_ivr_broadcast(switch_core_session_get_uuid(session),
md->sr[direction].map[dval].app, flags);
                                }
                                if ((md->sr[direction].map[dval].bind_flags
& SBF_ONCE)) {
                                        memset(&md->sr[direction].map[dval],
0, sizeof(md->sr[direction].map[dval]));

switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s
Unbinding meta digit '%c'\n",

switch_channel_get_name(channel), dtmf->digit);
                                }
                        } else {

switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING,
"%s Ignoring meta digit '%c' not mapped\n",

switch_channel_get_name(channel), dtmf->digit);
                        }


/*                        return SWITCH_STATUS_SUCCESS; */
                        return SWITCH_STATUS_FALSE;

        }



-----------------<-snip->-----------------------



usage in DP:

<action application="bind_long_dtmf" data="0 a s transfer::myExtension XML
myContext"/>



in myExtension you do your stuff!









On Wed, Aug 25, 2010 at 10:14 PM, Tihomir Culjaga <tculjaga at gmail.com>wrote:

>
>
> On Wed, Aug 25, 2010 at 7:47 PM, Nigel Kent <ktngl at yahoo.co.uk> wrote:
>
>> Have you tried using the event socket library
>> http://wiki.freeswitch.org/wiki/Esl
>>
>>
> well, i could have used esl from the start but thats and external
> application controling FS... and its totally a different approach from where
> im now:(.
> I have everything up & running except this feature ..
>
> so is there any chance to run a lua script in background (by allowing the
> normal callflow to go on) to collect a special DTMF event ?
>
> something like this:
>
> <action application="set" data="api_result=${lua(script.lua)}"/>
>
> ?
>
> T.
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20100827/42f3af1a/attachment.html 


More information about the FreeSWITCH-users mailing list