Загружается...
 
Переменная Asterisk - Hangupcause


Переменная Asterisk - Hangupcause


Hangupcause — это код причины окончания связи, используемый для канала zap, соединенным с интерфейсом PRI. Заметим, что он может применяться также и при работе через SIP каналы, а может быть и для некоторых других типов каналов.
Подсказка: пакет isdnutils содержит утилиту isdncause, которая предоставляет текстовое пояснение номера ошибки, которую вы подаете (внимательно в формату элемента).

Предыдущая CVS 2004-08-12:
Из causes.h:


  1. define AST_CAUSE_NOTDEFINED 0
  2. define AST_CAUSE_NORMAL 1
  3. define AST_CAUSE_BUSY 2
  4. define AST_CAUSE_FAILURE 3
  5. define AST_CAUSE_CONGESTION 4
  6. define AST_CAUSE_UNALLOCATED 5


Для версий CVS после 2004-08-12:


/* Causes for disconnection (from Q.931) */
  1. define AST_CAUSE_UNALLOCATED 1
  2. define AST_CAUSE_NO_ROUTE_TRANSIT_NET 2
  3. define AST_CAUSE_NO_ROUTE_DESTINATION 3
  4. define AST_CAUSE_CHANNEL_UNACCEPTABLE 6
  5. define AST_CAUSE_CALL_AWARDED_DELIVERED 7
  6. define AST_CAUSE_NORMAL_CLEARING 16
  7. define AST_CAUSE_USER_BUSY 17
  8. define AST_CAUSE_NO_USER_RESPONSE 18
  9. define AST_CAUSE_NO_ANSWER 19
  10. define AST_CAUSE_CALL_REJECTED 21
  11. define AST_CAUSE_NUMBER_CHANGED 22
  12. define AST_CAUSE_DESTINATION_OUT_OF_ORDER 27
  13. define AST_CAUSE_INVALID_NUMBER_FORMAT 28
  14. define AST_CAUSE_FACILITY_REJECTED 29
  15. define AST_CAUSE_RESPONSE_TO_STATUS_ENQUIRY 30
  16. define AST_CAUSE_NORMAL_UNSPECIFIED 31
  17. define AST_CAUSE_NORMAL_CIRCUIT_CONGESTION 34
  18. define AST_CAUSE_NETWORK_OUT_OF_ORDER 38
  19. define AST_CAUSE_NORMAL_TEMPORARY_FAILURE 41
  20. define AST_CAUSE_SWITCH_CONGESTION 42
  21. define AST_CAUSE_ACCESS_INFO_DISCARDED 43
  22. define AST_CAUSE_REQUESTED_CHAN_UNAVAIL 44
  23. define AST_CAUSE_PRE_EMPTED 45
  24. define AST_CAUSE_FACILITY_NOT_SUBSCRIBED 50
  25. define AST_CAUSE_OUTGOING_CALL_BARRED 52
  26. define AST_CAUSE_INCOMING_CALL_BARRED 54
  27. define AST_CAUSE_BEARERCAPABILITY_NOTAUTH 57
  28. define AST_CAUSE_BEARERCAPABILITY_NOTAVAIL 58
  29. define AST_CAUSE_BEARERCAPABILITY_NOTIMPL 65
  30. define AST_CAUSE_CHAN_NOT_IMPLEMENTED 66
  31. define AST_CAUSE_FACILITY_NOT_IMPLEMENTED 69
  32. define AST_CAUSE_INVALID_CALL_REFERENCE 81
  33. define AST_CAUSE_INCOMPATIBLE_DESTINATION 88
  34. define AST_CAUSE_INVALID_MSG_UNSPECIFIED 95
  35. define AST_CAUSE_MANDATORY_IE_MISSING 96
  36. define AST_CAUSE_MESSAGE_TYPE_NONEXIST 97
  37. define AST_CAUSE_WRONG_MESSAGE 98
  38. define AST_CAUSE_IE_NONEXIST 99
  39. define AST_CAUSE_INVALID_IE_CONTENTS 100
  40. define AST_CAUSE_WRONG_CALL_STATE 101
  41. define AST_CAUSE_RECOVERY_ON_TIMER_EXPIRE 102
  42. define AST_CAUSE_MANDATORY_IE_LENGTH_ERROR 103
  43. define AST_CAUSE_PROTOCOL_ERROR 111
  44. define AST_CAUSE_INTERWORKING 127
/* Special Asterisk aliases */
  1. define AST_CAUSE_BUSY AST_CAUSE_USER_BUSY
  2. define AST_CAUSE_FAILURE AST_CAUSE_NETWORK_OUT_OF_ORDER
  3. define AST_CAUSE_NORMAL AST_CAUSE_NORMAL_CLEARING
  4. define AST_CAUSE_NOANSWER AST_CAUSE_NO_ANSWER
  5. define AST_CAUSE_CONGESTION AST_CAUSE_NORMAL_CIRCUIT_CONGESTION
  6. define AST_CAUSE_NOTDEFINED 0


Замечание: это не будет работать для 0.7.1(можед и других версий) Смотри http://bugs.digium.com/bug_view_page.php?bug_id=0000890

Пример 1



[7-digit-PRI-Machine-2] ; The machine connected to PRI 2 (on its g1)
exten => _9NXXXXXX,1,Dial(Zap/g1/${EXTEN:1})
exten => _9NXXXXXX,2,gotoif,$[${HANGUPCAUSE} = 2]?99999|1
exten => 99999,1,Busy


Пример 2



[default]
exten => 91NXXNXXXXXX,1,Dial(${PSTN}/${EXTEN:1}
exten => 91NXXNXXXXXX,2,Macro(dial-result,${NUFONE}/${EXTEN:1})

[macro-dial-result]
;
; Handle Disconnect Cause Codes
;
exten => s,1,NoOp(HANGUPCAUSE is ${HANGUPCAUSE})
exten => s,2,AbsoluteTimeout(120)
exten => s,3,Goto(${HANGUPCAUSE},1)

exten => 0,1,NoOp(AST_CAUSE_NOTDEFINED)
exten => 0,2,GoToIf($"${SAVED_EXTEN}" != ""?0,4)
exten => 0,3,SetVar(SAVED_EXTEN=${MACRO_EXTEN})
exten => 0,4,GoToIf($"${SAVED_ARG1}" != ""?0,6)
exten => 0,5,SetVar(SAVED_ARG1=${ARG1})
exten => 0,6,GoToIf($"${ARG1}" = ""?0,11)
exten => 0,7,System(/bin/echo AST_CAUSE_NOTDEFINED received when dialing ${SAVED_EXTEN}. Trying again using ${SAVED_ARG1}. | /usr/bin/mutt -s "COLISEUM PBX ERROR" pbxadmin-pager@)
exten => 0,8,SetVar(ARG1=)
exten => 0,9,Dial(${SAVED_ARG1})
exten => 0,10,Macro(dial-result)
exten => 0,11,System(/bin/echo AST_CAUSE_NOTDEFINED received when dialing ${SAVED_ARG1}. Giving up. | /usr/bin/mutt -s "COLISEUM PBX ERROR" pbxadmin-pager)
exten => 0,12,Zapateller(answer)
exten => 0,13,Playback(an-error-has-occured)
exten => 0,14,Playback(pls-try-call-later)
exten => 0,15,Wait(3)
exten => 0,16,Zapateller(answer)
exten => 0,17,Playback(an-error-has-occured)
exten => 0,18,Playback(pls-try-call-later)
exten => 0,19,Wait(3)
exten => 0,20,Congestion

[handling of other cause codes removed for brevity]


и т.д...
Создано yulka. Последнее изменение: среда 13 / июнь, 2007 15:48:27 MSD автор yuri.