Jonathan Rivera
2007-Apr-05 00:06 UTC
[asterisk-users] How to return dialstatus of second (sub) call
Hello all I have this problem, i need a way to balance my "trunks" which are SIP peers, when a SIP peer is busy then send the call for another peer and so until i can send away the call, i think i can do it with queues. Ok this is the scenario: In extensions.conf [balance] exten => _XXXXXXXX,1,NoOp(Call to: ${EXTEN}) exten => _XXXXXXXX,2,Answer() exten => _XXXXXXXX,3,SetVar(_ORGEXTEN=${EXTEN}) exten => _XXXXXXXX,4,SetVar(_ORGUNIQUEID=${UNIQUEID}) exten => _XXXXXXXX,5,Set(CDR(userfield)=${ORGUNIQUEID}) exten => _XXXXXXXX,6,Queue(qtest,r) exten => _XXXXXXXX,7,Hangup() I have a queue with 100 members which are local channels In queues.conf [qtest] strategy=random member=>Local/1@salidas member=>Local/2@salidas member=>Local/3@salidas ... ... member=>Local/100@salidas Each member is an extension. In extensions.conf [salidas] exten => 1,1,Dial(SIP/TRUNK1/${ORGEXTEN},60,r) exten => 2,1,Dial(SIP/TRUNK2/${ORGEXTEN},60,r) exten => 3,1,Dial(SIP/TRUNK3/${ORGEXTEN},60,r) ... ... exten => 100,1,Dial(SIP/TRUNK100/${ORGEXTEN},60,r) exten => h,1,Set(CDR(userfield)=${ORGUNIQUEID}) Each TRUNK is a SIP peer. And i have anothers users which have the context balance. The question now is that i need return on the SIP message the dialstatus of the Dial on salidas context to the peer which is doing the call, now i always return ANSWARED because the Queue always answare, i need some way to tell the queue not return the dialstatus until the second call finish and i know the dialstatus and then return it dialstatus to the peer which is doing the call in the SIP message. Something like this User ---> doing the call ----> Queue | ------> Trying | ------> Dial on salidas | <------ Finish the call | <---- Return the dial status-- Someone have an idea? Regards. -- Jonathan Alberto Rivera Gomez http://linuxuanl.org
Robert Lister
2007-Apr-07 17:53 UTC
[asterisk-users] How to return dialstatus of second (sub) call
On Thu, Apr 05, 2007 at 02:06:53AM -0500, Jonathan Rivera wrote:> Hello all > > I have this problem, i need a way to balance my "trunks" which are SIP > peers, when a SIP peer is busy then send the call for another peer and > so until i can send away the call, i think i can do it with queues. > > Ok this is the scenario: > > In extensions.conf > > [balance] > exten => _XXXXXXXX,1,NoOp(Call to: ${EXTEN}) > exten => _XXXXXXXX,2,Answer() > exten => _XXXXXXXX,3,SetVar(_ORGEXTEN=${EXTEN}) > exten => _XXXXXXXX,4,SetVar(_ORGUNIQUEID=${UNIQUEID}) > exten => _XXXXXXXX,5,Set(CDR(userfield)=${ORGUNIQUEID}) > exten => _XXXXXXXX,6,Queue(qtest,r) > exten => _XXXXXXXX,7,Hangup() > > I have a queue with 100 members which are local channels > > In queues.conf > > [qtest] > strategy=random > member=>Local/1@salidas > member=>Local/2@salidas > member=>Local/3@salidasI had a similar problem of returning state to the queue manager to check the call state. You might want to try something like: exten => check,1,ChanIsAvail(Local/1@salidas,js); exten => check,102,Goto(busy,1); exten => busy,1,Busy(); Obviously you could replace this with a macro/DB lookup to avoid having lots of repeated entries in the dial plan. Busy() should return busy to the queue application if the Local channel is in use, causing it to skip to the next entry in the queue. After having a nightmare with chan_agent not working properly, I implemented a modified (for 1.2.x) version of: http://www.voip-info.org/wiki/view/Agents+without+agent+channel and stopped using AgentCallBackLogin(), which digium it appears have deprecated anyway in 1.4.x Agents without agent channel is a bit of a hack, but it works better than chan_agent in my case. This caused various other problems, notably that hints do not seem to work with Local/ channels, it shows them as always available. I have not found a workaround to this as yet. Any attempts I have made to dynamically update hints in the dialplan from asterisk CLI (add extension .....) seems to cause it to core dump in my case. Other than that, it works quite well. Rob -- Robert Lister - London Internet Exchange - http://www.linx.net/ robl@linx.net - tel: +44 (0)20 7645 3510 - RL786-RIPE