[asterisk-users] How to return dialstatus of second (sub) call

Jonathan Rivera jarg at linuxuanl.org
Thu Apr 5 00:06:53 MST 2007


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 at salidas
member=>Local/2 at salidas
member=>Local/3 at salidas
...
...
member=>Local/100 at 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


More information about the asterisk-users mailing list