[asterisk-users] PRI progress codes.

Eric "ManxPower" Wieling eric at fnords.org
Fri Mar 2 13:43:28 MST 2007


John Bittner wrote:
> Anyone know how to let asterisk deal with the progress codes coming
> from the carrier? The problem I am having is when a customer calls an
> invalid number the carrier tells me the call is invalid via a progress
> code but doesn't route me to a recording (this number is invalid).
> Instead they hang up on me causing a fast busy or sometimes hold up
> the call with dead air for 15 to 30 seconds then a fast busy. I am
> working with the carrier to get this fixed but its not going easy.
> Is there anyway when asterisk sees the progress code to cancel the
> dial and playback a message mapped to the progress code type.

[macro-dial-result]
;
; Handle Disconnect Cause Codes
;
exten => s,1,Noop(HANGUPCAUSE is ${HANGUPCAUSE} and DIALSTATUS is 
${DIALSTATUS})
exten => s,2,Noop
exten => s,3,GotoIf($[${HANGUPCAUSE} = 0]?s,5)
exten => s,4,Goto(cause-${HANGUPCAUSE},1)
exten => s,5,GotoIf($[${DIALSTATUS} = NOANSWER]?cause-16,1)
exten => s,6,GotoIf($[${DIALSTATUS} = BUSY]?cause-17,1)
exten => s,7,GotoIf($[${DIALSTATUS} = CHANUNAVAIL]?cause-3,1)
exten => s,8,GotoIf($[${DIALSTATUS} = ANSWER]?cause-16,1)
exten => s,9,Goto(cause-0,1)

exten => cause-0,1,NoOp(UNKNOWN)
exten => cause-0,2,Goto(redial,1)

exten => cause-1,1,NoOp(AST_CAUSE_UNALLOCATED)
exten => cause-1,2,Macro(number-disconnected,${MACRO_EXTEN})

exten => cause-2,1,NoOp(AST_CAUSE_NO_ROUTE_TRANSIT_NET)
exten => cause-2,2,Goto(redial,1)

exten => cause-3,1,NoOp(AST_CAUSE_NO_ROUTE_DESTINATION)
exten => cause-3,2,Goto(redial,1)

exten => cause-6,1,NoOp(AST_CAUSE_CHANNEL_UNACCEPTABLE)
exten => cause-6,2,Goto(redial,1)

exten => cause-7,1,NoOp(AST_CAUSE_CALL_AWARDED_DELIVERED)
exten => cause-7,2,Goto(redial,1)

exten => cause-16,1,NoOp(AST_CAUSE_NORMAL_CLEARING)
exten => cause-16,2,Hangup

exten => cause-17,1,NoOp(AST_CAUSE_USER_BUSY)
exten => cause-17,2,Busy

exten => cause-18,1,NoOp(AST_CAUSE_NO_USER_RESPONSE)
exten => cause-18,2,Goto(redial,1)

exten => cause-19,1,NoOp(AST_CAUSE_NO_ANSWER)
exten => cause-19,2,Goto(redial,1)

exten => cause-21,1,NoOp(AST_CAUSE_CALL_REJECTED)
exten => cause-21,2,Goto(redial,1)

exten => cause-22,1,NoOp(AST_CAUSE_NUMBER_CHANGED)
exten => cause-22,2,Goto(redial,1)

exten => cause-27,1,NoOp(AST_CAUSE_DESTINATION_OUT_OF_ORDER)
exten => cause-27,2,Goto(redial,1)

exten => cause-28,1,NoOp(AST_CAUSE_INVALID_NUMBER_FORMAT)
exten => cause-28,2,Goto(redial,1)

exten => cause-29,1,NoOp(AST_CAUSE_FACILITY_REJECTED)
exten => cause-29,2,Goto(redial,1)

exten => cause-30,1,NoOp(AST_CAUSE_RESPONSE_TO_STATUS_ENQUIRY)
exten => cause-30,2,Goto(redial,1)

exten => cause-31,1,NoOp(AST_CAUSE_NORMAL_UNSPECIFIED)
exten => cause-31,2,Hangup

exten => cause-34,1,NoOp(AST_CAUSE_NORMAL_CIRCUIT_CONGESTION)
exten => cause-34,2,Goto(redial,1)

exten => cause-38,1,NoOp(AST_CAUSE_NETWORK_OUT_OF_ORDER)
exten => cause-38,2,Goto(redial,1)

exten => cause-41,1,NoOp(AST_CAUSE_NORMAL_TEMPORARY_FAILURE)
exten => cause-41,2,Goto(redial,1)

exten => cause-42,1,NoOp(AST_CAUSE_SWITCH_CONGESTION)
exten => cause-42,2,Goto(redial,1)

exten => cause-43,1,NoOp(AST_CAUSE_ACCESS_INFO_DISCARDED)
exten => cause-43,2,Goto(redial,1)

exten => cause-44,1,NoOp(AST_CAUSE_REQUESTED_CHAN_UNAVAIL)
exten => cause-44,2,Goto(redial,1)

exten => cause-45,1,NoOp(AST_CAUSE_PRE_EMPTED)
exten => cause-45,2,Goto(redial,1)

exten => cause-50,1,NoOp(AST_CAUSE_FACILITY_NOT_SUBSCRIBED)
exten => cause-50,2,Goto(error,1)

exten => cause-52,1,NoOp(AST_CAUSE_OUTGOING_CALL_BARRED)
exten => cause-52,2,Goto(redial,1)

exten => cause-54,1,NoOp(AST_CAUSE_INCOMING_CALL_BARRED)
exten => cause-54,2,Goto(redial,1)

exten => cause-57,1,NoOp(AST_CAUSE_BEARERCAPABILITY_NOTAUTH)
exten => cause-57,2,Goto(redial,1)

exten => cause-58,1,NoOp(AST_CAUSE_BEARERCAPABILITY_NOTAVAIL)
exten => cause-58,2,Goto(redial,1)

exten => cause-65,1,NoOp(AST_CAUSE_BEARERCAPABILITY_NOTIMPL)
exten => cause-65,2,Goto(redial,1)

exten => cause-66,1,NoOp(AST_CAUSE_CHAN_NOT_IMPLEMENTED)
exten => cause-66,2,Goto(redial,1)

exten => cause-69,1,NoOp(AST_CAUSE_FACILITY_NOT_IMPLEMENTED)
exten => cause-69,2,Goto(redial,1)

exten => cause-81,1,NoOp(AST_CAUSE_INVALID_CALL_REFERENCE)
exten => cause-81,2,Goto(redial,1)

exten => cause-88,1,NoOp(AST_CAUSE_INCOMPATIBLE_DESTINATION)
exten => cause-88,2,Goto(redial,1)

exten => cause-95,1,NoOp(AST_CAUSE_INVALID_MSG_UNSPECIFIED)
exten => cause-95,2,Goto(redial,1)

exten => cause-96,1,NoOp(AST_CAUSE_MANDATORY_IE_MISSING)
exten => cause-96,2,Goto(redial,1)

exten => cause-97,1,NoOp(AST_CAUSE_MESSAGE_TYPE_NONEXIST)
exten => cause-97,2,Goto(redial,1)

exten => cause-98,1,NoOp(AST_CAUSE_WRONG_MESSAGE)
exten => cause-98,2,Goto(redial,1)

exten => cause-99,1,NoOp(AST_CAUSE_IE_NONEXIST)
exten => cause-99,2,Goto(redial,1)

exten => cause-100,1,NoOp(AST_CAUSE_INVALID_IE_CONTENTS)
exten => cause-100,2,Goto(redial,1)

exten => cause-101,1,NoOp(AST_CAUSE_WRONG_CALL_STATE)
exten => cause-101,2,Goto(redial,1)

exten => cause-102,1,NoOp(AST_CAUSE_RECOVERY_ON_TIMER_EXPIRE)
exten => cause-102,2,Goto(redial,1)

exten => cause-103,1,NoOp(AST_CAUSE_MANDATORY_IE_LENGTH_ERROR)
exten => cause-103,2,Goto(redial,1)

exten => cause-111,1,NoOp(AST_CAUSE_PROTOCOL_ERROR)
exten => cause-111,2,Goto(redial,1)

exten => cause-127,1,NoOp(AST_CAUSE_INTERWORKING)
exten => cause-127,2,Goto(redial,1)

exten => _cause-.,1,Goto(redial,1)

exten => redial,1,GotoIf($[${LEN(${ARG1})} = 0]?error,1)
exten => redial,n,System(/usr/local/bin/hangupcause-logging.pl ${EPOCH} 
${STRFTIME(${EPOCH},,%d%m%Y-%H:%M:%S)} ${SAVED_EXTEN} ${HANGUPCAUSE})
exten => redial,n,Noop
exten => redial,n,Dial(${ARG1},,g)
exten => redial,n,SetVar(ARG1=)
exten => redial,n,Macro(dial-result)

exten => error,1,AbsoluteTimeout(120)
exten => error,2,SetVar(ERROR_LOOP=1)
exten => error,3,Zapateller
exten => error,4,Playback(an-error-has-occured)
exten => error,5,Playback(pls-try-call-later)
exten => error,6,Wait(1)
exten => error,7,GotoIf($[${ERROR_LOOP) > 3]?error,10:error,8)
exten => error,8,SetVar(ERROR_LOOP=$[${ERROR_LOOP} + 1])
exten => error,9,Goto(error,3)
exten => error,10,Congestion


More information about the asterisk-users mailing list