[Freeswitch-users] Setting up callbacks

Alex Lake alex at digitalmail.com
Fri Jun 7 19:07:40 MSD 2013


Well, an example command as issued from within fs_cli is:

originate 
{origination_caller_id_name=CallBack,origination_caller_id_number=442074901234}sofia/internal/02070601234@${sip_gw_ip} 
442074901234 xml dp0024


Thi s will do a callback to 02070601234 and on answer will place an 
outbound call to 442074901234 within the "dp0024" context of the xml 
dialplan.

We have our own node.js fs_cli equivalent which gets a web hit and then 
puts together such a command string and sends it to freeswitch. There 
are a few other tricks that are useful:

1) We have the option for a "press 1 to confirm the outbound call" on 
the dialplan to avoid the case where a call back connects your voicemail 
to the destination(!)
2) We sometimes want to link the call to a transaction ID from the 
client - you can just bung that in the {} after originate and then pick 
it up in the event stream or CDRs.
> Alex, how did you do it? am so much intersted in the callbak sinario 
> you described, but do not have any idea of how to get it done.
>
>
> On 3 June 2013 08:26, Alex Lake <alex at digitalmail.com 
> <mailto:alex at digitalmail.com>> wrote:
>
>     As simple as that, eh?! Seems too good to be true! Thanks....
>>     You currently (in a previous mail) call a user/ dialstring and
>>     when that answers execute a bridge that dials a sofia/ dialstring
>>     and joins the 2 calls. The syntax was slightly off, but close.
>>
>>     Now think what'd happen if the 2 dialstrings were both sofia/
>>     dialstrings to dial 2 PSTN numbers via your SIP provider(s)...
>>
>>     You may need to tweak that further if you want either leg to go
>>     via the dialplan.
>>
>>     -Steve
>>
>>
>>     On Friday, May 31, 2013, Alex Lake wrote:
>>
>>         ...and for our next trick, how do I do a callback from one
>>         PSTN destination to another? i.e. place a call to 07775123456
>>         and when that answers, place another one to 02012345678?
>>
>>         Cheers,
>>         Alex
>>>         You almost got it: it's: exten [dialplan] [context]
>>>
>>>         So you just needed to do:
>>>         originate
>>>         {origination_caller_id_name=CallBack,origination_caller_id_number=07775123456}user/0095302
>>>         07775123456 xml dp0095
>>>         ... without the &bridge. You /either/ choose an extension or
>>>         do &(app).
>>>         Usage: originate <call_url> <exten>|&<application_name>(<app_args>)
>>>             [<dialplan>] [<context>] [<cid_name>] [<cid_num>] [<timeout_sec>]
>>>         To quote from the wiki:
>>>
>>>         "Here's an example of originating a call to an extension in
>>>         a different context than 'default' (required for the FreePBX
>>>         which uses context_1, context_2, etc.):"
>>>
>>>             originate sofia/internal/2001 at foo.com  3001 xml context_3
>>>         -Avi Marcus
>>>         BestFone
>>>
>>>
>>>         On Thu, Mar 7, 2013 at 4:02 PM, Alex Lake
>>>         <alex at digitalmail.com> wrote:
>>>
>>>             Yes, I'd seen that - but I'm currently the wrong side of
>>>             the "got it" fence. However, I did this:
>>>
>>>             originate
>>>             {origination_caller_id_name=CallBack,origination_caller_id_number=07775123456}user/0095302&bridge({origination_caller_id_number=2070602000}sofia/internal/07775123456 at pstngateway.com)
>>>
>>>             and it kind of did what I wanted.
>>>
>>>             However, what I really want to do is to simulate as
>>>             closely as possible what happens when ext 0095302 makes
>>>             an outbound call to 07775123456 from a handset -
>>>             preferably using the dp0095 context of the xml (?) dialplan.
>>>
>>>             So I thought I'd try using the dialplan and context
>>>             parameters like this:
>>>
>>>             originate
>>>             {origination_caller_id_name=CallBack,origination_caller_id_number=07775123456}user/0095302
>>>             &bridge(07775123456) xml dp0095
>>>
>>>             But I've clearly got the wrong end of the stick!
>>>
>>>>             There's a whole bunch of examples here:
>>>>             http://wiki.freeswitch.org/wiki/Mod_commands#originate
>>>>
>>>>             The first arg rings first, and must be an endpoint,
>>>>             e.g. sofia/, user/.
>>>>             Once they pick up, the second arg is called.
>>>>
>>>>             So originating to a local user or to a remote endpoint
>>>>             is nearly the same... especially if you can use the
>>>>             lcr/ endpoint.
>>>>             Your leg B can be a brige, a conference
>>>>             &conference(conf_uuid-TEST_CON), or just hit the dialplan.
>>>>
>>>>
>>>>             -Avi Marcus
>>>>
>>>>             On Thu, Mar 7, 2013 at 1:00 PM, Alex Lake
>>>>             <alex at digitalmail.com> wrote:
>>>>
>>>>                 I was wondering where's a good place to find some
>>>>                 examples of how, by
>>>>                 sending the right commands to the event_socket, I
>>>>                 could have Freeswitch
>>>>                 establish callbacks for me.
>>>>
>>>>                 Essentially there are a couple of different
>>>>                 termination types - PSTN
>>>>                 (via a gateway) and internally registered SIP accounts
>>>>
>>>>                 I would wish to be able to set up A->B (and maybe
>>>>                 small conferences)
>>>>                 using these types of destination in any combination.
>>>>
>>>>                 I've looked through the event_socket pages and the
>>>>                 "originate" syntax,
>>>>                 but would like to put together something a little
>>>>                 more "idiot-friendly"
>>>>                 so am looking around for precedents/tips...
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>                 _________________________________________________________________________
>>>>                 Professional FreeSWITCH Consulting Services:
>>>>                 consulting at freeswitch.org
>>>>                 http://www.freeswitchsolutions.com
>>>>
>>>>                 FreeSWITCH-powered IP PBX: The CudaTel
>>>>                 Communication Server
>>>>                 
>>>>
>>>>                 Official FreeSWITCH Sites
>>>>                 http://www.freeswitch.org
>>>>                 http://wiki.freeswitch.org
>>>>                 http://www.cluec <http://www.cluecon.com>
>>>>
>>>
>>>             _________________________________________________________________________
>>>             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
>>>
>>>
>>>
>>>
>>>         _________________________________________________________________________
>>>         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
>>>
>>>
>>>         No virus found in this message.
>>>         Checked by AVG - www.avg.com <http://www.avg.com>
>>>         Version: 2012.0.2240 / Virus Database: 2641/5652 - Release
>>>         Date: 03/06/13
>>>
>>
>>
>>
>>     _________________________________________________________________________
>>     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
>>
>>
>>     No virus found in this message.
>>     Checked by AVG - www.avg.com <http://www.avg.com>
>>     Version: 2012.0.2242 / Virus Database: 3162/5878 - Release Date:
>>     06/02/13 
>
>
>     _________________________________________________________________________
>     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
>
>
>
>
> -- 
> /Emmanuel O. Addai,/
> /+233(0)26 757 7771/
>
>
> _________________________________________________________________________
> 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
>
>
> No virus found in this message.
> Checked by AVG - www.avg.com <http://www.avg.com>
> Version: 2012.0.2242 / Virus Database: 3184/5886 - Release Date: 06/05/13
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20130607/01dd6fc1/attachment-0001.html 


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