เคยเขียนไว้ใน Asterisk hangup causes แต่จริงๆ แล้ว Asterisk implement hangup cause มาเพียง 2 ใน 3 เท่านั้นเอง ลองดูด้านล่าง สีแดงคือ hangup code ที่ Asterisk ไม่ได้ implement เอาไว้
0 | Valid cause code not yet received
1 | Unallocated (unassigned) number
2 | No route to specified transit network (WAN)
3 | No route to destination
4 | send special information tone
5 | misdialled trunk prefix.
6 | Channel unacceptable
7 | Call awarded and being delivered in an established channel
8 | Prefix 0 dialed but not allowed
9 | Prefix 1 dialed but not allowed
10 | Prefix 1 dialed but not required
11 | More digits received than allowed, call is proceeding
16 | Normal call clearing
17 | User busy
18 | No user responding
19 | no answer from user
21 | Call rejected
22 | Number changed
23 | Reverse charging rejected
24 | Call suspended
25 | Call resumed
26 | Non-selected user clearing
27 | Destination out of order
28 | Invalid number format (incomplete number)
29 | Facility rejected
30 | Response to STATUS ENQUIRY
31 | Normal, unspecified
33 | Circuit out of order
34 | No circuit/channel available
35 | Destination unattainable
37 | Degraded service
38 | Network (WAN) out of order
39 | Transit delay range cannot be achieved
40 | Throughput range cannot be achieved
41 | Temporary failure
42 | Switching equipment congestion
43 | Access information discarded
44 | Requested circuit channel not available
45 | Pre-empted
46 | Precedence call blocked
47 | Resource unavailable - unspecified
49 | Quality of service unavailable
50 | Requested facility not subscribed
51 | Reverse charging not allowed
52 | Outgoing calls barred
53 | Outgoing calls barred within CUG
54 | Incoming calls barred
55 | Incoming calls barred within CUG
56 | Call waiting not subscribed
57 | Bearer capability not authorized
58 | Bearer capability not presently available
63 | Service or option not available, unspecified
65 | Bearer service not implemented
66 | Channel type not implemented
67 | Transit network selection not implemented
68 | Message not implemented
69 | Requested facility not implemented
70 | Only restricted digital information bearer capability is available
79 | Service or option not implemented, unspecified
81 | Invalid call reference value
82 | Identified channel does not exist
83 | A suspended call exists, but this call identity does not
84 | Call identity in use
85 | No call suspended
86 | Call having the requested call identity has been cleared
87 | Called user not member of CUG
88 | Incompatible destination
89 | Non-existent abbreviated address entry
90 | Destination address missing, and direct call not subscribed
91 | Invalid transit network selection (national use)
92 | Invalid facility parameter
93 | Mandatory information element is missing
95 | Invalid message, unspecified
96 | Mandatory information element is missing
97 | Message type non-existent or not implemented
98 | Message not compatible with call state or message type non-existent or not implemented
99 | information element nonexistant or not implemented
100 | Invalid information element contents
101 | Message not compatible with call state
102 | Recovery on timer expiry
103 | parameter non-existent or not implemented - passed on
111 | Protocol error unspecified
127 | Internetworking, unspecified
คิดว่าคงมีเหตุผลบางอย่าง หรือคิดว่าอาจไม่จำเป็นต้องใช้ แต่ผมมองว่าก็น่าจะ implement มาให้หมดไม่ดีกว่าหรือ? ไว้มีโอกาสผมจะ implement hangup cause ที่เหลืออยู่เหล่านี้เข้าไป (ใช้ opensource มาหลาย project ผมน่าจะทำอะไรเพื่อ opensource ซะบ้าง)
ยังดี Asterisk ปล่อยค่า HangupCause ตามที่ได้คืนมาจาก PRI (E1/T1/J1) ดังนั้นเราจึงสามารถนำ hangup cause เหล่านี้มาใช้ได้ สำหรับ PHP ผมได้ใช้ code ดังนี้
$HANGUPCAUSE_DESCRIPTION = array (
"" => array("", ""),
"0" => array("AST_CAUSE_NOTDEFINED", "Valid cause code not yet received"),
"1" => array("AST_CAUSE_UNALLOCATED", "Unallocated (unassigned) number"),
"2" => array("AST_CAUSE_NO_ROUTE_TRANSIT_NET", "No route to specified transmit network"),
"3" => array("AST_CAUSE_NO_ROUTE_DESTINATION", "No route to destination"),
"6" => array("AST_CAUSE_CHANNEL_UNACCEPTABLE", "Channel unacceptable"),
"7" => array("AST_CAUSE_CALL_AWARDED_DELIVERED", "Call awarded and being delivered in an established channel"),
"8" => array("[not implement]", "Prefix 0 dialed but not allowed"),
"9" => array("[not implement]", "Prefix 1 dialed but not allowed"),
"10" => array("[not implement]", "Prefix 1 dialed but not required"),
"16" => array("AST_CAUSE_NORMAL_CLEARING", "Normal Clearing"),
"17" => array("AST_CAUSE_USER_BUSY", "User busy"),
"18" => array("AST_CAUSE_NO_USER_RESPONSE", "No user responding"),
"19" => array("AST_CAUSE_NO_ANSWER", "User alerting, no answer"),
"21" => array("AST_CAUSE_CALL_REJECTED", "Call Rejected"),
"22" => array("AST_CAUSE_NUMBER_CHANGED", "Number changed"),
"23" => array("[not implement]", "Reverse charging rejected"),
"24" => array("[not implement]", "Call suspended"),
"25" => array("[not implement]", "Call resumed"),
"26" => array("[not implement]", "Non-selected user clearing"),
"27" => array("AST_CAUSE_DESTINATION_OUT_OF_ORDER", "Destination out of order"),
"28" => array("AST_CAUSE_INVALID_NUMBER_FORMAT", "Invalid number format"),
"29" => array("AST_CAUSE_FACILITY_REJECTED", "Facility rejected"),
"30" => array("AST_CAUSE_RESPONSE_TO_STATUS_ENQUIRY", "Response to STATus ENQuiry"),
"31" => array("AST_CAUSE_NORMAL_UNSPECIFIED", "Normal, unspecified"),
"33" => array("[not implement]", "Circuit out of order"),
"34" => array("AST_CAUSE_NORMAL_CIRCUIT_CONGESTION", "Circuit/channel congestion"),
"35" => array("[not implement]", "Destination unattainable"),
"37" => array("[not implement]", "Degraded service"),
"38" => array("AST_CAUSE_NETWORK_OUT_OF_ORDER", "Network out of order"),
"39" => array("[not implement]", "Transit delay range cannot be achieved"),
"40" => array("[not implement]", "Throughput range cannot be achieved"),
"41" => array("AST_CAUSE_NORMAL_TEMPORARY_FAILURE", "Temporary failure"),
"42" => array("AST_CAUSE_SWITCH_CONGESTION", "Switching equipment congestion"),
"43" => array("AST_CAUSE_ACCESS_INFO_DISCARDED", "Access information discarded"),
"44" => array("AST_CAUSE_REQUESTED_CHAN_UNAVAIL", "Requested channel not available"),
"45" => array("AST_CAUSE_PRE_EMPTED", "Pre-empted"),
"46" => array("[not implement]", "Precedence call blocked"),
"47" => array("[not implement]", "Resource unavailable - unspecified"),
"49" => array("[not implement]", "Quality of service unavailable"),
"50" => array("AST_CAUSE_FACILITY_NOT_SUBSCRIBED", "Facility not subscribed"),
"51" => array("[not implement]", "Reverse charging not allowed"),
"52" => array("AST_CAUSE_OUTGOING_CALL_BARRED", "Outgoing call barred"),
"53" => array("[not implement]", "Outgoing calls barred within CUG"),
"54" => array("AST_CAUSE_INCOMING_CALL_BARRED", "Incoming calls barred"),
"55" => array("[not implement]", "Incoming calls barred within CUG"),
"56" => array("[not implement]", "Call waiting not subscribed"),
"57" => array("AST_CAUSE_BEARERCAPABILITY_NOTAUTH", "Bearer capability not authorized"),
"58" => array("AST_CAUSE_BEARERCAPABILITY_NOTAVAIL", "Bearer capability not available"),
"63" => array("[not implement]", "Service or option not availabled, unspecified"),
"65" => array("AST_CAUSE_BEARERCAPABILITY_NOTIMPL", "Bearer capability not implemented"),
"66" => array("AST_CAUSE_CHAN_NOT_IMPLEMENTED", "Channel not implemented"),
"67" => array("[not implement]", "Transit network selection not implemented"),
"68" => array("[not implement]", "Message not implemented"),
"69" => array("AST_CAUSE_FACILITY_NOT_IMPLEMENTED", "Facility not implemented"),
"70" => array("[not implement]", "Only restricted digital information bearer capability is available"),
"79" => array("[not implement]", "Service or option not implemented, unspecified"),
"81" => array("AST_CAUSE_INVALID_CALL_REFERENCE", "Invalid call reference value"),
"82" => array("[not implement]", "Identified channel does not exist"),
"83" => array("[not implement]", "A suspended call exists, but this call identity does no call identity in use"),
"85" => array("[not implement]", "No call suspended"),
"86" => array("[not implement]", "Call having the requested call identity has been cleared"),
"87" => array("[not implement]", "Called user not member of CUG"),
"88" => array("AST_CAUSE_INCOMPATIBLE_DESTINATION", "Incompatible destination"),
"89" => array("[not implement]", "Non-existent abbreviated address entry"),
"90" => array("[not implement]", "Destination address missing, and direct call not subscribed"),
"91" => array("[not implement]", "Invalid transit network selection (national use)"),
"92" => array("[not implement]", "Invalid facility parameter"),
"93" => array("[not implement]", "Mandatory information element is missing"),
"95" => array("AST_CAUSE_INVALID_MSG_UNSPECIFIED", "Invalid message unspecified"),
"96" => array("AST_CAUSE_MANDATORY_IE_MISSING", "Mandatory information element is missing"),
"97" => array("AST_CAUSE_MESSAGE_TYPE_NONEXIST", "Message type nonexist or not implemented"),
"98" => array("AST_CAUSE_WRONG_MESSAGE", "Wrong message - message not compatible with call state or message type non-existent or not implemented"),
"99" => array("AST_CAUSE_IE_NONEXIST", "Information element nonexistant or not implemented"),
"100" => array("AST_CAUSE_INVALID_IE_CONTENTS", "Invalid information element contents"),
"101" => array("AST_CAUSE_WRONG_CALL_STATE", "Message not compatible with call state"),
"102" => array("AST_CAUSE_RECOVERY_ON_TIMER_EXPIRE", "Recover on timer expiry"),
"103" => array("AST_CAUSE_MANDATORY_IE_LENGTH_ERROR", "Mandatory IE length error - parameter non-existent or not implemented - pass on"),
"111" => array("AST_CAUSE_PROTOCOL_ERROR", "Protocol error, unspecified"),
"127" => array("AST_CAUSE_INTERWORKING", "Interworking, unspecified")
);
ใครอยากเอาไปใช้ ก็เอาไป