[Freeswitch-users] origainate through sofia gateway

Jacek Sokulski jsokulski at dotsystems.pl
Wed Feb 4 06:46:07 PST 2009


Thanks Anthony,
the js snippets are very instructive. 
A couple of points:
1. The code with apiExecute does not work (local phone is connected, but
after picking up it hungs up immediately), other examples are working
fine.

2. It does not show how initiate external call without existing session.

3. How can one pass the call through dialplan?

Jacek

PS.
we got the code probable from wiki or from this mialing list.

Dnia 04-02-2009, śro o godzinie 08:09 -0600, Anthony Minessale pisze:
> Where did you learn how to use js this way?
> session.originate is being misused here and is depricated and may be
> removed.
> 
> the first arg to session.originate is either undefined or a
> *different* session (the a leg)
> 
> session1 = new Session();
> session1.originate(undefined,
> "{ignore_early_media=true}user/1008 at 192.168.1.122");
> 
> session1.setVariable("effective_caller_id_number","fixed0248b");
> 
> //once you have session1 when you originate session2 you pass session1
> as the arg 
> // the effective_caller_id is taken from session1
> 
> session2 = new Session();
> session2.originate(session1, "sofia/gateway/halonet/0225490317");
> 
> Anyway this whole code is depricated in favor of this:
> 
> session1 = new
> Session("{ignore_early_media=true}user/1008 at 192.168.1.122");
> 
> if (session1.ready()) {
>   session1.setVariable("effective_caller_id_number","fixed0248b");
>   session2 = new Session("sofia/gateway/halonet/0225490317",
> session1);
> }
> 
> and could be further refactored down to this:
> 
> session1 = new
> Session("{ignore_early_media=true}user/1008 at 192.168.1.122");
> if (session1.ready()) {
>   session1.setVariable("effective_caller_id_number","fixed0248b");
>   session1.execute("bridge", "sofia/gateway/halonet/0225490317");
> }
> 
> or down to this one line of code that will setup the call detached
> from the script and exit.
> 
> var result = apiExecute("originate",
> "{effective_caller_id_number=fixed0248b,origination_caller_id_number=1000,ignore_early_media=true}user/1008 at 192.168.1.122 bridge:sofia/gateway/halonet/0225490317 inline");
> 
> if you dont care about the result and want to exit even before the
> call is completed.
> 
> var result = apiExecute("bgapi", "originate
> {effective_caller_id_number=fixed0248b,origination_caller_id_number=1000,ignore_early_media=true}user/1008 at 192.168.1.122 bridge:sofia/gateway/halonet/0225490317 inline");
> 
> 
> 
> On Wed, Feb 4, 2009 at 2:51 AM, Jacek Sokulski
> <jsokulski at dotsystems.pl> wrote:
>         
>         We have tried setting both effective_caller_id_number and
>         origination_caller_id_number:
>         
>         session1.originate(session1,"{origination_caller_id_number=fixed0248b}sofia/gateway/halonet/0225490317",15);
>          but the problem still exists. The solution we have found for
>         the case
>         when we originate two calls, local and external, is as follow:
>         
>         session1 = new Session();
>         session1.originate(session1,"user/1003 at 192.168.1.122",15);//local
>         if(session1.ready()) {
>            session1.execute("execute_extension","00930691688627 XML
>         default");//external
>         }
>         
>         so the external call goes through the dialplan.
>         It does not work if both calls are external. One possible
>         solution could be
>         to pass the originating call through dialplan (loopback?) but
>         we have not managed
>         to figure out how to do it.
>         
>         Thanks
>         Jacek
>         
>         Dnia 03-02-2009, wto o godzinie 14:31 -0300, Nicolas Brenner
>         pisze:
>         
>         > Oops! Well, fortunately I don't use that voip provider
>         anymore (nor the script).
>         >
>         > Thanks Brian.
>         >
>         > Nicolas
>         >
>         > On Tue, Feb 3, 2009 at 2:25 PM, Brian West
>         <brian at freeswitch.org> wrote:
>         > > YOU should NEVER use this method or call setCallerData at
>         all  you
>         > > should use the correct methods to override the callerid.
>         > >
>         > > If its a B-Leg born from an A-Leg you use these on the on
>         the A-Leg:
>         > >
>         > >
>         http://wiki.freeswitch.org/wiki/Channel_Variables#effective_caller_id_name
>         > >
>         http://wiki.freeswitch.org/wiki/Channel_Variables#effective_caller_id_number
>         > >
>         > > If you're originating you use this:
>         > >
>         > >
>         http://wiki.freeswitch.org/wiki/Channel_Variables#origination_caller_id_name
>         > >
>         http://wiki.freeswitch.org/wiki/Channel_Variables#origination_caller_id_number
>         > >
>         > > /b
>         >
>         > _______________________________________________
>         > 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
> GTALK/JABBER/PAYPAL:anthony.minessale at gmail.com
> IRC: irc.freenode.net #freeswitch
> 
> FreeSWITCH Developer Conference
> sip:888 at conference.freeswitch.org
> iax:guest at conference.freeswitch.org/888
> googletalk:conf+888 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





More information about the FreeSWITCH-users mailing list