[Freeswitch-users] How to bridge a call to an extension defined in dialplan

Hector Geraldino Hector.Geraldino at ipsoft.com
Tue Feb 28 18:24:08 MSK 2012


You can find the syntax for eavesdrop in the wiki. Here's how I have it working:

    api originate sofia/internal/1234 at x.x.x.x &eavesdrop(aleg_uuid)

You can try this command in the fs_cli command line (w/o the 'api' prefix). Eavesdrop will allow you to jump into a call and monitor the conversation. If the call has been bridged, you can hear both legs.

You can do the bridge however you want. The bridge operation is not related to the eavesdrop, so the way I have this working is:

1. I answer the call in the dialplan, and transfer the control to my java app (just as you're doing right now)
2. I originate a 2nd call to an internal extension.
3. When the 2nd call is answered, I bridge both calls using uuid_bridge uuid_lega uuid_legb (you can even do the bridge from the dialplan)
4. I start recording the call using 'uuid_record uuid_lega' (again, you can call the record application from the dialplan)
5. I can (if desired) monitor the call by originating a 3rd call to the manager extension + passing the uuid_lega to the eavesdrop app, as discussed before.

Hope this helps


-----Original Message-----
From: freeswitch-users-bounces at lists.freeswitch.org [mailto:freeswitch-users-bounces at lists.freeswitch.org] On Behalf Of x.liu
Sent: Tuesday, February 28, 2012 9:08 AM
To: freeswitch-users at lists.freeswitch.org
Subject: Re: [Freeswitch-users] How to bridge a call to an extension defined in dialplan

Hi Hector,

Many thanks for your advice!

I had a try but without success yet. What I am doing is

1. call to an extension: 5801, it will execute my ESL Java app. I call
it a-leg
<extension name="myEslNew5801">
<condition field="destination_number" expression="^5801$">
<action application="limit" data="hash outgoing 5801 4" />
<action application="socket" data="127.0.0.1:9981 async full"/>
</condition>
</extension>

2. From my ESL Java app, I originate b-leg to my softphoe and eavesdrop
on extension 5801 by
     response = sendSyncSingleLineCommand(ctx.getChannel(), "api
originate sofia/internal/1003%x.x.x.x 1003 &eavesdrop " +
this.channelUniqueID);
     the channelUniqueID is the UUID of my a-leg session.

     So I hope my app do the recording and talking to the user and I
listen it from the softphone 1003 via eavesdrop.

      At the moment I got message: Hangup on 1003 with [CS-ROUTING]
[NO_ROUTE_DESTINATION]

     I am not quite sure if I understand correctly how the eavesdrop works:

     Which UUID should I use in "&eavesdrop UUID", the existing one of
a-leg or I need to create a new one for b-leg?
     Do I need to do the bridge, in extension 5801 or in my app?


Thanks!
Xing



On 02/27/2012 08:59 PM, Hector Geraldino wrote:
> You can: bridge two endpoints (A ->  B), record the conversation using uuid_record (or the record application), and have a 3rd extension hearing the conversation using the eavesdrop app. Here's how I've done this before:
>
> Incoming call (A-Party)
> Bridge call to B-Party (bridge 1xxx at example.domain)
> Record the conversation (uuid_record aleg_uuid /path/to/audio.file)
> A C-Party listen using eavesdrop (originate 2xxx at example.domain&eavesdrop aleg_uuid)
>
>
> -----Original Message-----
> From: freeswitch-users-bounces at lists.freeswitch.org [mailto:freeswitch-users-bounces at lists.freeswitch.org] On Behalf Of x.liu
> Sent: Monday, February 27, 2012 2:52 PM
> To: freeswitch-users at lists.freeswitch.org
> Subject: Re: [Freeswitch-users] How to bridge a call to an extension defined in dialplan
>
> Hi Peter,
>
> Thanks for your reply!
>
> You are right, that is what I have been experiencing but not I wanted.
>
> Actually my goal is simply to record the user call by my app (js or java
> via ESL) and at the same time
> I want to hear what the user is saying through my computer's speaker.
>
> The recording app seems to be ok ( I tried recording via dialplan
> commands as well as ESL Java app).
> What I am doing now is to bridge the call to my app for recording and to
> a softphone for hearing user's voice.
>
> I thought it would work as the wiki says the bridge can bridge the call
> to multiple endpoints at the same time,
> but unfortunately it won't work for me.
>
> Any suggestions to achieve my goal please: recording and hearing user's
> voice?
>     (Note: my app will do the recording and also allow me send TTS to the
> user)
>
> Best,
> Xing
>
>
>
> On 02/27/2012 06:33 PM, Peter Olsson wrote:
>> Can you explain what you're trying to achieve by doing this?
>>
>> If you bridge to multiple destinations, the first destination that answers will create the actual call - all other legs are terminated.
>>
>> /Peter
>>
>> Från: freeswitch-users-bounces at lists.freeswitch.org [freeswitch-users-bounces at lists.freeswitch.org] för x.liu [x.liu at hw.ac.uk]
>> Skickat: den 27 februari 2012 19:11
>> Till: freeswitch-users at lists.freeswitch.org
>> Ämne: Re: [Freeswitch-users] How to bridge a call to an extension defined in dialplan
>>
>> Hi again,
>>
>> It looks like there is something wrong relating to the [CS_CONSUME_MEDIA] [ORIGINATOR_CANCEL],
>> but no idea how this happened.
>>
>> A bit desperately to solve this problem ASAP as we will have a demo in a few days.
>>
>> Please could anybody give any clue?
>>
>> Many thanks!
>>
>> On 02/27/2012 11:34 AM, x.liu wrote:
>> Now I tried it at a different machine with different version of FS.
>> The behaviour is slightly different. This time the softphone is ringing but the recording extension is not correctly executed.
>> The version for this test is "FreeSWITCH Version 1.0.head (git-e566057 2011-12-14 10-27-31 -0500)"
>>    (The FS version for previous tries is "FreeSWITCH Version 1.0.head (git-54ddef0 2011-12-06 21-53-45 -0600)" )
>>
>> I copy part of terminal message here, hope it is not too much message for the email list.
>>
>> --------------------------------------------------
>> 09:04.180223 [NOTICE] switch_channel.c:920 New Channel sofia/external/anonymous at sipgate.co.uk<mailto:sofia/external/anonymous at sipgate.co.uk>   [7596ad60-6133-11e1-9141-8b50a5b8b13b]
>> 09:04.180223 [INFO] mod_dialplan_xml.c:481 Processing anonymous<anonymous>->74997 in context public
>> 09:04.180223 [NOTICE] switch_channel.c:920 New Channel sofia/internal/1003 at x.x.x.x<mailto:sofia/internal/1003 at x.x.x.x>   [75976d18-6133-11e1-9145-8b50a5b8b13b]
>> 09:04.180223 [NOTICE] switch_channel.c:920 New Channel sofia/internal/74999 at x.x.x.x<mailto:sofia/internal/74999 at x.x.x.x>   [75977f24-6133-11e1-914a-8b50a5b8b13b]
>> 09:04.180223 [NOTICE] switch_channel.c:920 New Channel sofia/internal/anonymous at x.x.x.x<mailto:sofia/internal/anonymous at x.x.x.x>   [7597aab2-6133-11e1-914e-8b50a5b8b13b]
>> 09:04.180223 [INFO] mod_dialplan_xml.c:481 Processing anonymous<anonymous>->1003 in context public
>> 09:04.180223 [NOTICE] switch_channel.c:920 New Channel sofia/internal/anonymous at x.x.x.x<mailto:sofia/internal/anonymous at x.x.x.x>   [75980192-6133-11e1-9150-8b50a5b8b13b]
>> 09:04.180223 [NOTICE] switch_ivr.c:1711 Transfer sofia/external/anonymous at sipgate.co.uk<mailto:sofia/external/anonymous at sipgate.co.uk>   to XML[1003 at public]
>> 09:04.180223 [NOTICE] switch_ivr_originate.c:3182 Hangup sofia/internal/1003 at x.x.x.x<mailto:sofia/internal/1003 at x.x.x.x>   [CS_CONSUME_MEDIA] [ORIGINATOR_CANCEL]
>> 09:04.180223 [NOTICE] switch_ivr_originate.c:3182 Hangup sofia/internal/74999 at x.x.x.x<mailto:sofia/internal/74999 at x.x.x.x>   [CS_CONSUME_MEDIA] [ORIGINATOR_CANCEL]
>> 09:04.180223 [INFO] mod_dptools.c:2897 Originate Failed.  Cause: ORIGINATOR_CANCEL
>> 09:04.180223 [INFO] mod_dialplan_xml.c:481 Processing anonymous<anonymous>->1003 in context public
>> 09:04.180223 [NOTICE] switch_core_session.c:1397 Session 2 (sofia/internal/1003 at x.x.x.x<mailto:sofia/internal/1003 at x.x.x.x>) Ended
>> 09:04.180223 [NOTICE] switch_core_session.c:1399 Close Channel sofia/internal/1003 at x.x.x.x<mailto:sofia/internal/1003 at x.x.x.x>   [CS_DESTROY]
>> 09:04.180223 [NOTICE] switch_ivr.c:1711 Transfer sofia/external/anonymous at sipgate.co.uk<mailto:sofia/external/anonymous at sipgate.co.uk>   to XML[1003 at default]
>> 09:04.180223 [INFO] mod_dialplan_xml.c:481 Processing anonymous<anonymous>->1003 in context default
>> 09:04.180223 [NOTICE] sofia.c:427 Hangup sofia/internal/anonymous at x.x.x.x<mailto:sofia/internal/anonymous at x.x.x.x>   [CS_EXECUTE] [BLIND_TRANSFER]
>> 09:04.201188 [NOTICE] switch_core_session.c:1397 Session 4 (sofia/internal/anonymous at x.x.x.x<mailto:sofia/internal/anonymous at x.x.x.x>) Ended
>> 09:04.201188 [NOTICE] switch_core_session.c:1399 Close Channel sofia/internal/anonymous at x.x.x.x<mailto:sofia/internal/anonymous at x.x.x.x>   [CS_DESTROY]
>> 09:04.201188 [INFO] switch_ivr_async.c:3164 Bound B-Leg: *1 execute_extension::dx XML features
>> 09:04.201188 [INFO] mod_dialplan_xml.c:481 Processing anonymous<anonymous>->74999 in context public
>> 09:04.201188 [INFO] switch_ivr_async.c:3164 Bound B-Leg: *2 record_session:: recordings/anonymous.2012-02-27-11-09-04.wav
>> 09:04.201188 [NOTICE] switch_core_session.c:1397 Session 3 (sofia/internal/74999 at x.x.x.x<mailto:sofia/internal/74999 at x.x.x.x>) Ended
>> 09:04.201188 [NOTICE] switch_core_session.c:1399 Close Channel sofia/internal/74999 at x.x.x.x<mailto:sofia/internal/74999 at x.x.x.x>   [CS_DESTROY]
>> 09:04.201188 [INFO] switch_ivr_async.c:3164 Bound B-Leg: *3 execute_extension::cf XML features
>> 09:04.201188 [NOTICE] sofia.c:6134 Hangup sofia/internal/anonymous at x.x.x.x<mailto:sofia/internal/anonymous at x.x.x.x>   [CS_EXECUTE] [ORIGINATOR_CANCEL]
>> 09:04.201188 [INFO] switch_ivr_async.c:3164 Bound B-Leg: *4 execute_extension::att_xfer XML features
>> 09:04.201188 [NOTICE] switch_core_session.c:1397 Session 5 (sofia/internal/anonymous at x.x.x.x<mailto:sofia/internal/anonymous at x.x.x.x>) Ended
>> 09:04.201188 [NOTICE] switch_core_session.c:1399 Close Channel sofia/internal/anonymous at x.x.x.x<mailto:sofia/internal/anonymous at x.x.x.x>   [CS_DESTROY]
>> 09:04.201188 [NOTICE] switch_channel.c:920 New Channel sofia/internal/sip:1003 at y.y.y.y:5062 [759a6630-6133-11e1-9158-8b50a5b8b13b]
>> 09:04.740223 [NOTICE] sofia.c:5462 Ring-Ready sofia/internal/sip:1003 at y.y.y.y:5062!
>> 09:04.740223 [NOTICE] mod_sofia.c:2470 Ring-Ready sofia/external/anonymous at sipgate.co.uk<mailto:sofia/external/anonymous at sipgate.co.uk>!
>> 09:04.740223 [NOTICE] switch_ivr_originate.c:483 Ring Ready sofia/external/anonymous at sipgate.co.uk<mailto:sofia/external/anonymous at sipgate.co.uk>!
>> 09:07.700221 [NOTICE] sofia.c:6040 Channel [sofia/internal/sip:1003 at y.y.y.y:5062] has been answered
>> 09:07.700221 [NOTICE] switch_ivr_originate.c:483 Ring Ready sofia/external/anonymous at sipgate.co.uk<mailto:sofia/external/anonymous at sipgate.co.uk>!
>> -------------------------------------------------
>>
>>
>> Hi,
>>
>> H tried this way
>>
>> <action application="bridge" data="sofia/internal/1003%${sip_profile},sofia/internal/74991@${domain}"/>
>>
>> 74991 is reached and I heard the prompt. The 1003 softphone is terminated immediately after it is reached.
>> then extension 74991 hung up itself as well.
>>
>> I saw the terminal message:
>> mod_dptools.c:2897 Originate Failed.  Cause: ORIGINATOR_CANCEL
>>
>> What would be the reason for that?
>>
>> Thanks,
>> Xing
>>
>>
>>
>> On 02/26/2012 10:29 PM, Liu, Xingkun wrote:
>>
>>
>> Hello,
>>
>> I'd like to bridge an incoming to two endpoints simultaneuously:
>> one is a softphone which is registered to FS (to user 1003),
>> another is just an extension which is defined in conf/dialplan/public.xml
>>
>> It looks like:
>>
>> <extension name="testRecording_bridge">
>>     <condition field="destination_number" expression="^(74990)$">
>>       <action application="bridge" data="sofia/internal/1003%${sip_profile},sofia/internal/74991%${sip_profile}"/>
>>     </condition>
>> </extension>
>>
>> <extension name="testRecordingOnly">
>>       <condition field="destination_number" expression="^74991$">
>>         <action application="set" data="record_waste_resources=true"/>
>>         <action application="javascript" data="testRecordFile.js"/>
>>       </condition>
>>     </extension>
>>
>> The incoming call dial to extension 74990, from there I want to bridge the call to the sofphone at 1003 and
>> to the extension 74991.
>>
>> The problem is that FS can not locate user 74991. So my question is what else I need to modify in order
>> to bridge the call also to extension 74991 at the same time?
>>
>> I did lots of Googling, checked the wiki and tried various ways but still without success.
>>
>> Any advices please?
>>
>> Many Thanks!
>> Xing
>>
>> ________________________________
>>
>> Heriot-Watt University is the Sunday Times Scottish University of the Year 2011-2012.
>>
>> Heriot-Watt University is a Scottish charity registered under charity number SC000278.
>>
>>
>> _________________________________________________________________________
>> Professional FreeSWITCH Consulting Services:
>> consulting at freeswitch.org<mailto:consulting at freeswitch.org>
>> http://www.freeswitchsolutions.com
>>
>> 
>> 
>>
>> Official FreeSWITCH Sites
>> http://www.freeswitch.org
>> http://wiki.freeswitch.org
>> http://www.cluecon.com
>>
>> FreeSWITCH-users mailing list
>> FreeSWITCH-users at lists.freeswitch.org<mailto: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
>>
>>
>>
>> ________________________________
>>
>> Heriot-Watt University is the Sunday Times Scottish University of the Year 2011-2012.
>>
>> Heriot-Watt University is a Scottish charity registered under charity number SC000278.
>>
>>
>> _________________________________________________________________________
>> Professional FreeSWITCH Consulting Services:
>> consulting at freeswitch.org<mailto:consulting at freeswitch.org>
>> http://www.freeswitchsolutions.com
>>
>> 
>> 
>>
>> Official FreeSWITCH Sites
>> http://www.freeswitch.org
>> http://wiki.freeswitch.org
>> http://www.cluecon.com
>>
>> FreeSWITCH-users mailing list
>> FreeSWITCH-users at lists.freeswitch.org<mailto: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
>>
>>
>>
>> ________________________________
>>
>> Heriot-Watt University is the Sunday Times Scottish University of the Year 2011-2012.
>>
>> Heriot-Watt University is a Scottish charity registered under charity number SC000278.
>>
>>
>> _________________________________________________________________________
>> Professional FreeSWITCH Consulting Services:
>> consulting at freeswitch.org<mailto:consulting at freeswitch.org>
>> http://www.freeswitchsolutions.com
>>
>> 
>> 
>>
>> Official FreeSWITCH Sites
>> http://www.freeswitch.org
>> http://wiki.freeswitch.org
>> http://www.cluecon.com
>>
>> FreeSWITCH-users mailing list
>> FreeSWITCH-users at lists.freeswitch.org<mailto: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
>>
>>
>>
>> ________________________________
>>
>> Heriot-Watt University is the Sunday Times Scottish University of the Year 2011-2012.
>>
>> Heriot-Watt University is a Scottish charity registered under charity number SC000278.
>> !DSPAM:4f4bc71e32767806511310!
>>
>> _________________________________________________________________________
>> Professional FreeSWITCH Consulting Services:
>> consulting at freeswitch.org
>> http://www.freeswitchsolutions.com
>>
>> 
>> 
>>
>> Official FreeSWITCH Sites
>> http://www.freeswitch.org
>> http://wiki.freeswitch.org
>> http://www.cluecon.com
>>
>> 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
>
>



--
Heriot-Watt University is a Scottish charity
registered under charity number SC000278.

Heriot-Watt University is the Sunday Times
Scottish University of the Year 2011-2012



_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
consulting at freeswitch.org
http://www.freeswitchsolutions.com




Official FreeSWITCH Sites
http://www.freeswitch.org
http://wiki.freeswitch.org
http://www.cluecon.com

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



Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-users mailing list