@ -116,52 +116,53 @@ static AST_LIST_HEAD_STATIC(channels, ast_channel);
/*! map AST_CAUSE's to readable string representations */
const struct ast_cause {
int cause ;
const char * name ;
const char * desc ;
} causes [ ] = {
{ AST_CAUSE_UNALLOCATED , " U nallocated (unassigned) number" } ,
{ AST_CAUSE_NO_ROUTE_TRANSIT_NET , " N o route to specified transmit network" } ,
{ AST_CAUSE_NO_ROUTE_DESTINATION , " N o route to destination" } ,
{ AST_CAUSE_CHANNEL_UNACCEPTABLE , " C hannel unacceptable" } ,
{ AST_CAUSE_CALL_AWARDED_DELIVERED , " C all awarded and being delivered in an established channel" } ,
{ AST_CAUSE_NORMAL_CLEARING , " N ormal Clearing" } ,
{ AST_CAUSE_USER_BUSY , " U ser busy" } ,
{ AST_CAUSE_NO_USER_RESPONSE , " N o user responding" } ,
{ AST_CAUSE_NO_ANSWER , " User alerting, no answer" } ,
{ AST_CAUSE_CALL_REJECTED , " C all Rejected" } ,
{ AST_CAUSE_NUMBER_CHANGED , " N umber changed" } ,
{ AST_CAUSE_DESTINATION_OUT_OF_ORDER , " D estination out of order" } ,
{ AST_CAUSE_INVALID_NUMBER_FORMAT , " I nvalid number format" } ,
{ AST_CAUSE_FACILITY_REJECTED , " F acility rejected" } ,
{ AST_CAUSE_RESPONSE_TO_STATUS_ENQUIRY , " R esponse to STATus ENQuiry" } ,
{ AST_CAUSE_NORMAL_UNSPECIFIED , " N ormal, unspecified" } ,
{ AST_CAUSE_NORMAL_CIRCUIT_CONGESTION , " Circuit/channel congestion" } ,
{ AST_CAUSE_NETWORK_OUT_OF_ORDER , " N etwork out of order" } ,
{ AST_CAUSE_NORMAL_TEMPORARY_FAILURE , " Temporary failure" } ,
{ AST_CAUSE_SWITCH_CONGESTION , " S witching equipment congestion" } ,
{ AST_CAUSE_ACCESS_INFO_DISCARDED , " A ccess information discarded" } ,
{ AST_CAUSE_REQUESTED_CHAN_UNAVAIL , " R equested channel not available" } ,
{ AST_CAUSE_PRE_EMPTED , " P re-empted" } ,
{ AST_CAUSE_FACILITY_NOT_SUBSCRIBED , " F acility not subscribed" } ,
{ AST_CAUSE_OUTGOING_CALL_BARRED , " O utgoing call barred" } ,
{ AST_CAUSE_INCOMING_CALL_BARRED , " I ncoming call barred" } ,
{ AST_CAUSE_BEARERCAPABILITY_NOTAUTH , " B earer capability not authorized" } ,
{ AST_CAUSE_BEARERCAPABILITY_NOTAVAIL , " B earer capability not available" } ,
{ AST_CAUSE_BEARERCAPABILITY_NOTIMPL , " B earer capability not implemented" } ,
{ AST_CAUSE_CHAN_NOT_IMPLEMENTED , " C hannel not implemented" } ,
{ AST_CAUSE_FACILITY_NOT_IMPLEMENTED , " F acility not implemented" } ,
{ AST_CAUSE_INVALID_CALL_REFERENCE , " I nvalid call reference value" } ,
{ AST_CAUSE_INCOMPATIBLE_DESTINATION , " I ncompatible destination" } ,
{ AST_CAUSE_INVALID_MSG_UNSPECIFIED , " I nvalid message unspecified" } ,
{ AST_CAUSE_MANDATORY_IE_MISSING , " M andatory information element is missing" } ,
{ AST_CAUSE_MESSAGE_TYPE_NONEXIST , " M essage type nonexist." } ,
{ AST_CAUSE_WRONG_MESSAGE , " W rong message" } ,
{ AST_CAUSE_IE_NONEXIST , " I nfo. element nonexist or not implemented" } ,
{ AST_CAUSE_INVALID_IE_CONTENTS , " I nvalid information element contents" } ,
{ AST_CAUSE_WRONG_CALL_STATE , " Message not compatible with call state" } ,
{ AST_CAUSE_RECOVERY_ON_TIMER_EXPIRE , " R ecover on timer expiry" } ,
{ AST_CAUSE_MANDATORY_IE_LENGTH_ERROR , " M andatory IE length error" } ,
{ AST_CAUSE_PROTOCOL_ERROR , " P rotocol error, unspecified" } ,
{ AST_CAUSE_INTERWORKING , " I nterworking, unspecified" } ,
{ AST_CAUSE_UNALLOCATED , " U NALLOCATED" , " U nallocated (unassigned) number" } ,
{ AST_CAUSE_NO_ROUTE_TRANSIT_NET , " N O_ROUTE_TRANSIT_NET" , " N o route to specified transmit network" } ,
{ AST_CAUSE_NO_ROUTE_DESTINATION , " N O_ROUTE_DESTINATION" , " N o route to destination" } ,
{ AST_CAUSE_CHANNEL_UNACCEPTABLE , " C HANNEL_UNACCEPTABLE" , " C hannel unacceptable" } ,
{ AST_CAUSE_CALL_AWARDED_DELIVERED , " C ALL_AWARDED_DELIVERED" , " C all awarded and being delivered in an established channel" } ,
{ AST_CAUSE_NORMAL_CLEARING , " N ORMAL_CLEARING" , " N ormal Clearing" } ,
{ AST_CAUSE_USER_BUSY , " U SER_BUSY" , " U ser busy" } ,
{ AST_CAUSE_NO_USER_RESPONSE , " N O_USER_RESPONSE" , " N o user responding" } ,
{ AST_CAUSE_NO_ANSWER , " NO_ANSWER" , " User alerting, no answer" } ,
{ AST_CAUSE_CALL_REJECTED , " C ALL_REJECTED" , " C all Rejected" } ,
{ AST_CAUSE_NUMBER_CHANGED , " N UMBER_CHANGED" , " N umber changed" } ,
{ AST_CAUSE_DESTINATION_OUT_OF_ORDER , " D ESTINATION_OUT_OF_ORDER" , " D estination out of order" } ,
{ AST_CAUSE_INVALID_NUMBER_FORMAT , " I NVALID_NUMBER_FORMAT" , " I nvalid number format" } ,
{ AST_CAUSE_FACILITY_REJECTED , " F ACILITY_REJECTED" , " F acility rejected" } ,
{ AST_CAUSE_RESPONSE_TO_STATUS_ENQUIRY , " R ESPONSE_TO_STATUS_ENQUIRY" , " R esponse to STATus ENQuiry" } ,
{ AST_CAUSE_NORMAL_UNSPECIFIED , " N ORMAL_UNSPECIFIED" , " N ormal, unspecified" } ,
{ AST_CAUSE_NORMAL_CIRCUIT_CONGESTION , " NORMAL_CIRCUIT_CONGESTION" , " Circuit/channel congestion" } ,
{ AST_CAUSE_NETWORK_OUT_OF_ORDER , " N ETWORK_OUT_OF_ORDER" , " N etwork out of order" } ,
{ AST_CAUSE_NORMAL_TEMPORARY_FAILURE , " NORMAL_TEMPORARY_FAILURE" , " Temporary failure" } ,
{ AST_CAUSE_SWITCH_CONGESTION , " S WITCH_CONGESTION" , " S witching equipment congestion" } ,
{ AST_CAUSE_ACCESS_INFO_DISCARDED , " A CCESS_INFO_DISCARDED" , " A ccess information discarded" } ,
{ AST_CAUSE_REQUESTED_CHAN_UNAVAIL , " R EQUESTED_CHAN_UNAVAIL" , " R equested channel not available" } ,
{ AST_CAUSE_PRE_EMPTED , " P RE_EMPTED" , " P re-empted" } ,
{ AST_CAUSE_FACILITY_NOT_SUBSCRIBED , " F ACILITY_NOT_SUBSCRIBED" , " F acility not subscribed" } ,
{ AST_CAUSE_OUTGOING_CALL_BARRED , " O UTGOING_CALL_BARRED" , " O utgoing call barred" } ,
{ AST_CAUSE_INCOMING_CALL_BARRED , " I NCOMING_CALL_BARRED" , " I ncoming call barred" } ,
{ AST_CAUSE_BEARERCAPABILITY_NOTAUTH , " B EARERCAPABILITY_NOTAUTH" , " B earer capability not authorized" } ,
{ AST_CAUSE_BEARERCAPABILITY_NOTAVAIL , " B EARERCAPABILITY_NOTAVAIL" , " B earer capability not available" } ,
{ AST_CAUSE_BEARERCAPABILITY_NOTIMPL , " B EARERCAPABILITY_NOTIMPL" , " B earer capability not implemented" } ,
{ AST_CAUSE_CHAN_NOT_IMPLEMENTED , " C HAN_NOT_IMPLEMENTED" , " C hannel not implemented" } ,
{ AST_CAUSE_FACILITY_NOT_IMPLEMENTED , " F ACILITY_NOT_IMPLEMENTED" , " F acility not implemented" } ,
{ AST_CAUSE_INVALID_CALL_REFERENCE , " I NVALID_CALL_REFERENCE" , " I nvalid call reference value" } ,
{ AST_CAUSE_INCOMPATIBLE_DESTINATION , " I NCOMPATIBLE_DESTINATION" , " I ncompatible destination" } ,
{ AST_CAUSE_INVALID_MSG_UNSPECIFIED , " I NVALID_MSG_UNSPECIFIED" , " I nvalid message unspecified" } ,
{ AST_CAUSE_MANDATORY_IE_MISSING , " M ANDATORY_IE_MISSING" , " M andatory information element is missing" } ,
{ AST_CAUSE_MESSAGE_TYPE_NONEXIST , " M ESSAGE_TYPE_NONEXIST" , " M essage type nonexist." } ,
{ AST_CAUSE_WRONG_MESSAGE , " W RONG_MESSAGE" , " W rong message" } ,
{ AST_CAUSE_IE_NONEXIST , " I E_NONEXIST" , " I nfo. element nonexist or not implemented" } ,
{ AST_CAUSE_INVALID_IE_CONTENTS , " I NVALID_IE_CONTENTS" , " I nvalid information element contents" } ,
{ AST_CAUSE_WRONG_CALL_STATE , " WRONG_CALL_STATE" , " Message not compatible with call state" } ,
{ AST_CAUSE_RECOVERY_ON_TIMER_EXPIRE , " R ECOVERY_ON_TIMER_EXPIRE" , " R ecover on timer expiry" } ,
{ AST_CAUSE_MANDATORY_IE_LENGTH_ERROR , " M ANDATORY_IE_LENGTH_ERROR" , " M andatory IE length error" } ,
{ AST_CAUSE_PROTOCOL_ERROR , " P ROTOCOL_ERROR" , " P rotocol error, unspecified" } ,
{ AST_CAUSE_INTERWORKING , " I NTERWORKING" , " I nterworking, unspecified" } ,
} ;
@ -477,6 +478,18 @@ const char *ast_cause2str(int cause)
return " Unknown " ;
}
/*! \brief Convert a symbolic hangup cause to number */
int ast_str2cause ( const char * name )
{
int x ;
for ( x = 0 ; x < sizeof ( causes ) / sizeof ( causes [ 0 ] ) ; x + + )
if ( strncasecmp ( causes [ x ] . name , name , strlen ( causes [ x ] . name ) ) = = 0 )
return causes [ x ] . cause ;
return - 1 ;
}
/*! \brief Gives the string form of a given channel state */
char * ast_state2str ( int state )
{