[Freeswitch-users] Finding all active calls belonging to the same phone

Brian West brian at freeswitch.org
Wed Jun 10 19:29:49 PDT 2009


Why not use the presence events to keep that state?

/b

On Jun 10, 2009, at 7:31 PM, John Wehle wrote:

> To duplicate our old PBX park functionality I need for a user who's
> on a call to be able to pick up a second line and dial a number to
> park the other call which is on his phone.  I have something working,
> however am curious if there's a better way to accomplish this.
>
> Specifically I'm curious if there's a recommended way to find all the
> calls to / from the same phone / channel.
>
> I ended up configuring *5 to call a javascript program which:
>
>  a) Gets the uuid from the session and uses it to search "show  
> channels"
>     to find the channel name.
>
>  b) Normalizes the channel name and uses it to search "show channels"
>     to find an uuid associated with the channel which is different  
> from
>     the one that invoked *5.
>
>  c) Uses the uuid from "b" to search "show calls" to find the peer
>     uuid.
>
>  d) Uses uuid_setvar to set hangup_after_bridge=false and  
> uuid_transfer
>     to transfer the peer uuid to the proper fifo.
>
> One of the problems I ran into is the channel name has slightly  
> different
> formats depending on whether it is an inbound or outbound channel.   
> E.g.:
>
>  sofia/internal/1003 at XXX.XXX.XXX.XXX
>  sofia/internal/1003 at XXX.XXX.XXX.XXX:5060
>  sofia/internal/sip:1003 at YYY.YYY.YYY.YYY:5060;transport=udp;...
>
> where XXX is the freeswitch box and YYY is the phone.  I created the
> following function to normalize the channel name for comparison:
>
> function normalize_channel_name (name, direction, ip_addr)
>  {
>  var re = /^sofia\//g;
>  var length = name.search (re);
>  var new_name = name;
>
>  if (length == -1)
>    return new_name;
>
>  if (direction == "inbound") {
>    re = /@.*$/g;
>
>    new_name = name.replace (re, "@" + ip_addr);
>    }
>  else if (direction == "outbound") {
>    re = /\/sip:(.*@[^:]*):.*$/g;
>
>    new_name = name.replace (re, "/$1");
>    }
>
>  return new_name;
>  }
>
> Suggestions for a better approach?  Keep in mind that my existing user
> population expects (for better or worse) to use *5 to park the call on
> their phone so I'm somewhat limited in what I can do.
>
> -- John
> -------------------------------------------------------------------------
> |   Feith Systems  |   Voice: 1-215-646-8000  |  Email:  
> john at feith.com  |
> |    John Wehle    |     Fax: 1-215-540-5495   
> |                         |
> -------------------------------------------------------------------------
>
>
> _______________________________________________
> 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