Hunting¶
Hunting (from English hunt) - a process of sequential dialing different routes until connection is established or Smartswitch determines that it's impossible to deliver a call.
After routing table has been composed during Routing process, Smartswitch begins to hunt.
A call is first directed to a route with highest priority.
After this outbound Call handler is invoked for each route and he gets a dialstring inside variable ${DIALSTRING}.
When invoking outbound call handler, control is passed to StartExtension branch of that call handler.
For example, according to routing configuration need to dial peer "telco_gw1" using H323 protocol and B-number 380972568744.
Smartswitch will invoke outbound call handler configured on peer "telco_gw1" and will pass to it variable ${DIALSTRING}, which contains_H323/telco_gw1380972568744_.
Outbound call handler should end with MacroExit element.
Otherwise there will be no hunting to the next peer.
In case if generated outbound call is hanged up without connection, then a call to a second route by priority is generated.
Call generation according routing table is performed as long as one of next conditions is accomplished:
- call has been connected
Call is considered connected, if outbound call handler set variable DIALSTATUS to ANSWER.
This variable in outbound call handler usually sets Dial application when callee picks up.
- all routes have been tried
System has tries all routes and still couldn't deliver a call.
- attributes of delivered call have been present.
These attributes are:
- indication about answered call (for example, Connect in H.323 protocol, 200 OK in SIP protocol)
- indication about ring-back generation (for example, Alerting in H.323 protocol, Ringing in SIP protocol)
- indication about call being accepted for delivery by end user (for example Progress in H.323 protocol and SIP protocol).
Usually on acceptance of these messages equipment opens media-channels and starts media streams bridging.
- call has been hanged up by terminator with hangup cause, which indicates that end user has been alerted, but he is not reachable
Such codes are:
- AST_CAUSE_USER_BUSY (user busy)
- AST_CAUSE_NO_ANSWER (user hasn't pick up)
- AST_CAUSE_NORMAL_CLEARING (user hanged up incoming call)
See more about disconnect cause codes in section Matching disconnect causes SIP/Asterisk/Q.931.
- call has been cancelled by originator
Caller can cancel a call in the middle of hunting by hanging up.
Русский перевод