[Freeswitch-users] SIP re-invite / bypass_media

Phillip Jones pjintheusa at gmail.com
Thu Jul 2 10:27:56 PDT 2009


Used:

session.execute("set","bypass_media_after_bridge=true");
in the confirm.js script and that works perfectly!

Thank you for you help!
On Thu, Jul 2, 2009 at 1:05 PM, Anthony Minessale <
anthony.minessale at gmail.com> wrote:

> try setting bypass_media_after_bridge=true on the session in your confirm
> script
>
>
>
> On Thu, Jul 2, 2009 at 11:53 AM, Phillip Jones <pjintheusa at gmail.com>wrote:
>
>> Thanks for responding and for your help.
>>
>> The xml and confirm.js are attached below. Basically trying to
>> bypass_media after the leg B presses 1 to accept the call. I tried,
>> using bypass_media_after_bridge=true, but the re-invite appears to be done
>> before the confirm.js, So the media is successfully rerouted, but BEFORE the
>> leg b never gets hear a prompt or gets the opportunity to press 1.
>>
>> To get round this I am trying to manually bypass_media in the confirm.js
>> script with apiExecute("uuid_media", "off " + session.uuid);. However only
>> the B leg is reinvited (and media is routed correctly). I don't see the A
>> leg reinvite, and then a BYE is issueed on both legs.
>>
>> <extension name="public_did">
>> <condition field="destination_number" expression="^(12125553666)$">
>>
>> <action application="set" data="domain_name=$${domain}"/>
>> <action application="set" data="call_timeout=60"/>
>> <action application="set" data="group_confirm_key=exec"/>
>> <action application="set" data="group_confirm_file=javascript
>> confirm.js"/><
>> <action application="bridge" data="[leg_confirm=y]
>> sofia/gateway/broadvox/6095553828"/>
>>
>> </condition>
>> </extension>
>> </include>
>>
>> This is the confirm.js:
>>
>> // confirm.js - FreeSwitch call confirmation script
>> // (c) 2009 - St‚phane Alnet
>> // License: GPL2 or above
>> console_log("info", "Destination: "+ session.destination + "\n");
>> if(!session.getVariable('leg_confirm'))
>> {
>> console_log("info", "No need to confirm, connect the call!\n");
>> exit();
>> }
>> var confirmed = false;
>> var confirmation_digit = "1";
>> var try_count = 6;
>> var prompt_file = "prompts/ToAcceptThisCallPress1.wav";
>> function onInput( session, type, data, arg ) {
>> if ( type == "dtmf" ) {
>> console_log( "info", "Got digit " + data.digit + "\n" );
>> if ( data.digit == confirmation_digit ) {
>> confirmed = true;
>> console_log( "info", "Confirming session..\n" );
>> return(false);
>> }
>> }
>> return(true);
>> }
>> if ( session.ready() )
>> {
>> session.answer();
>> session.flushDigits();
>> console_log("info", "Starting confirmation\n");
>> var count = try_count;
>> while( session.ready() && ! confirmed && count-- > 0 )
>> {
>> session.execute("sleep","200");
>> session.streamFile( prompt_file, onInput );
>> }
>>
>> if( ! confirmed )
>> {
>> console_log("info", "Not confirmed\n");
>> session.hangup();
>> }
>> else
>> {
>>  *apiExecute("uuid_media", "off " + session.uuid);*
>> console_log("info", "Confirmed\n");
>> }
>> }
>> else
>> {
>> console_log("info", "Session is not ready.\n");
>> }
>>
>>
>>
>>
>> On Thu, Jul 2, 2009 at 12:19 PM, Anthony Minessale <
>> anthony.minessale at gmail.com> wrote:
>>
>>> I would need to know more details about what you are doing.
>>>
>>> you could set the variable bypass_media_after_bridge=true on the a leg
>>> before you call the b leg and use the group_confirm feature to get the
>>> caller
>>> to press the key.
>>>
>>>
>>>
>>> On Thu, Jul 2, 2009 at 10:41 AM, Phillip Jones <pjintheusa at gmail.com>wrote:
>>>
>>>> Thanks for that.
>>>>
>>>> That seems to successfully re-invite and re-route the the B leg - but
>>>> does not reinvite the A leg and then immediately issues a "bye" on both
>>>> legs.
>>>>
>>>> Do I have to do something to reinvite that A leg?
>>>>
>>>>   On Wed, Jul 1, 2009 at 7:06 PM, Anthony Minessale <
>>>> anthony.minessale at gmail.com> wrote:
>>>>
>>>>> try
>>>>> apiExecute("uuid_media", "off " + session.uuid);
>>>>>
>>>>>
>>>>>
>>>>>   On Wed, Jul 1, 2009 at 3:22 PM, Phillip Jones <pjintheusa at gmail.com>wrote:
>>>>>
>>>>>>   Hi there,
>>>>>>
>>>>>> I was wondering whether it is possible to have FreeSwitch go into
>>>>>> bypass_media mode on demand?
>>>>>>
>>>>>> For instance, leg a bridges to leg b - leg b is invited to accept the
>>>>>> call by pressing 1. I want to go to bypass_media (do a SIP reinvite to
>>>>>> reroute the media) after the one is pressed.
>>>>>>
>>>>>> Currently I am issuing the following from my js script that prompts
>>>>>> for the 1:
>>>>>>
>>>>>> session.apiExecute("uuid_media",session.uuid);
>>>>>>
>>>>>> Not working however.
>>>>>>
>>>>>> Any help to get me going would be appreciated.
>>>>>>
>>>>>> Thanks
>>>>>>
>>>>>> Phillip Jones.
>>>>>>
>>>>>> _______________________________________________
>>>>>> Freeswitch-users mailing list
>>>>>> Freeswitch-users at lists.freeswitch.org
>>>>>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>>>>>> UNSUBSCRIBE:
>>>>>> http://lists.freeswitch.org/mailman/options/freeswitch-users
>>>>>> http://www.freeswitch.org
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Anthony Minessale II
>>>>>
>>>>> FreeSWITCH http://www.freeswitch.org/
>>>>> ClueCon http://www.cluecon.com/
>>>>>
>>>>> AIM: anthm
>>>>> MSN:anthony_minessale at hotmail.com<MSN%3Aanthony_minessale at hotmail.com>
>>>>> GTALK/JABBER/PAYPAL:anthony.minessale at gmail.com<PAYPAL%3Aanthony.minessale at gmail.com>
>>>>> IRC: irc.freenode.net #freeswitch
>>>>>
>>>>> FreeSWITCH Developer Conference
>>>>> sip:888 at conference.freeswitch.org<sip%3A888 at conference.freeswitch.org>
>>>>> iax:guest at conference.freeswitch.org/888
>>>>> googletalk:conf+888 at conference.freeswitch.org<googletalk%3Aconf%2B888 at conference.freeswitch.org>
>>>>> pstn:213-799-1400
>>>>>
>>>>> _______________________________________________
>>>>> Freeswitch-users mailing list
>>>>> Freeswitch-users at lists.freeswitch.org
>>>>> 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
>>>> Freeswitch-users at lists.freeswitch.org
>>>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>>>> UNSUBSCRIBE:
>>>> http://lists.freeswitch.org/mailman/options/freeswitch-users
>>>> http://www.freeswitch.org
>>>>
>>>>
>>>
>>>
>>> --
>>> Anthony Minessale II
>>>
>>> FreeSWITCH http://www.freeswitch.org/
>>> ClueCon http://www.cluecon.com/
>>>
>>> AIM: anthm
>>> MSN:anthony_minessale at hotmail.com <MSN%3Aanthony_minessale at hotmail.com>
>>> GTALK/JABBER/PAYPAL:anthony.minessale at gmail.com<PAYPAL%3Aanthony.minessale at gmail.com>
>>> IRC: irc.freenode.net #freeswitch
>>>
>>> FreeSWITCH Developer Conference
>>> sip:888 at conference.freeswitch.org <sip%3A888 at conference.freeswitch.org>
>>> iax:guest at conference.freeswitch.org/888
>>> googletalk:conf+888 at conference.freeswitch.org<googletalk%3Aconf%2B888 at conference.freeswitch.org>
>>> pstn:213-799-1400
>>>
>>> _______________________________________________
>>> Freeswitch-users mailing list
>>> Freeswitch-users at lists.freeswitch.org
>>> 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
>> Freeswitch-users at lists.freeswitch.org
>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
>> http://www.freeswitch.org
>>
>>
>
>
> --
> Anthony Minessale II
>
> FreeSWITCH http://www.freeswitch.org/
> ClueCon http://www.cluecon.com/
>
> AIM: anthm
> MSN:anthony_minessale at hotmail.com <MSN%3Aanthony_minessale at hotmail.com>
> GTALK/JABBER/PAYPAL:anthony.minessale at gmail.com<PAYPAL%3Aanthony.minessale at gmail.com>
> IRC: irc.freenode.net #freeswitch
>
> FreeSWITCH Developer Conference
> sip:888 at conference.freeswitch.org <sip%3A888 at conference.freeswitch.org>
> iax:guest at conference.freeswitch.org/888
> googletalk:conf+888 at conference.freeswitch.org<googletalk%3Aconf%2B888 at conference.freeswitch.org>
> pstn:213-799-1400
>
> _______________________________________________
> Freeswitch-users mailing list
> Freeswitch-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20090702/db946465/attachment-0002.html 


More information about the FreeSWITCH-users mailing list