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/[email protected] > sofia/internal/[email protected]:5060 > sofia/internal/sip:[email protected]: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: > [email protected] | > | John Wehle | Fax: 1-215-540-5495 > | | > ------------------------------------------------------------------------- > > > _______________________________________________ > Freeswitch-users mailing list > [email protected] > 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 [email protected] http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
