libisdn
|
00001 /***************************************************************************** 00002 00003 FileName: Q850.c 00004 00005 Contents: ITU-T Q.850 cause codes 00006 00007 License/Copyright: 00008 00009 Copyright (c) 2008, Stefan Knoblich, axsentis GmbH. All rights reserved. 00010 email: s.knoblich@axsentis.de 00011 00012 Redistribution and use in source and binary forms, with or without 00013 modification, are permitted provided that the following conditions are 00014 met: 00015 00016 * Redistributions of source code must retain the above copyright notice, 00017 this list of conditions and the following disclaimer. 00018 * Redistributions in binary form must reproduce the above copyright notice, 00019 this list of conditions and the following disclaimer in the documentation 00020 and/or other materials provided with the distribution. 00021 * Neither the name of the axsentis GmbH nor the names of its contributors 00022 may be used to endorse or promote products derived from this software 00023 without specific prior written permission. 00024 00025 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00026 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00027 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00028 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 00029 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 00030 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 00031 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00032 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 00033 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 00034 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00035 POSSIBILITY OF SUCH DAMAGE. 00036 *****************************************************************************/ 00037 #include <stdlib.h> 00038 00039 #include "Q931.h" 00040 00041 struct Q850CauseName 00042 { 00043 const int id; 00044 const char *name; 00045 00046 } Q850CauseNames[] = { 00047 { Q850_CAUSE_NONE, "None" }, 00048 { Q850_CAUSE_UNALLOCATED, "Unallocated" }, 00049 { Q850_CAUSE_NO_ROUTE_TRANSIT_NET, "No route transit net" }, 00050 { Q850_CAUSE_NO_ROUTE_DESTINATION, "No route destination" }, 00051 { Q850_CAUSE_CHANNEL_UNACCEPTABLE, "Channel unacceptable" }, 00052 { Q850_CAUSE_CALL_AWARDED_DELIVERED, "" }, 00053 { Q850_CAUSE_NORMAL_CLEARING, "Normal clearing" }, 00054 { Q850_CAUSE_USER_BUSY, "User busy" }, 00055 { Q850_CAUSE_NO_USER_RESPONSE, "No user response" }, 00056 { Q850_CAUSE_NO_ANSWER, "No answer" }, 00057 { Q850_CAUSE_SUBSCRIBER_ABSENT, "Subscriber absent" }, 00058 { Q850_CAUSE_CALL_REJECTED, "Call rejected" }, 00059 { Q850_CAUSE_NUMBER_CHANGED, "Number changed" }, 00060 { Q850_CAUSE_REDIRECTION_TO_NEW_DESTINATION, "Redirection to new destination" }, 00061 { Q850_CAUSE_EXCHANGE_ROUTING_ERROR, "Exchange routing error" }, 00062 { Q850_CAUSE_DESTINATION_OUT_OF_ORDER, "Destination out of order" }, 00063 { Q850_CAUSE_INVALID_NUMBER_FORMAT, "Invalid number format" }, 00064 { Q850_CAUSE_FACILITY_REJECTED, "Facility rejected" }, 00065 { Q850_CAUSE_RESPONSE_TO_STATUS_ENQUIRY, "Response to STATUS ENQUIRY" }, 00066 { Q850_CAUSE_NORMAL_UNSPECIFIED, "Unspecified" }, 00067 { Q850_CAUSE_NORMAL_CIRCUIT_CONGESTION, "Circuit congestion" }, 00068 { Q850_CAUSE_NETWORK_OUT_OF_ORDER, "Network out of order" }, 00069 { Q850_CAUSE_NORMAL_TEMPORARY_FAILURE, "Temporary failure" }, 00070 { Q850_CAUSE_SWITCH_CONGESTION, "Switch congestion" }, 00071 { Q850_CAUSE_ACCESS_INFO_DISCARDED, "Access info discarded" }, 00072 { Q850_CAUSE_REQUESTED_CHAN_UNAVAIL, "Requested channel unavailable" }, 00073 { Q850_CAUSE_PRE_EMPTED, "Pre-empted" }, 00074 { Q850_CAUSE_FACILITY_NOT_SUBSCRIBED, "Facility not subscribed" }, 00075 { Q850_CAUSE_OUTGOING_CALL_BARRED, "Outgoing call barred" }, 00076 { Q850_CAUSE_INCOMING_CALL_BARRED, "Incoming call barred" }, 00077 { Q850_CAUSE_BEARERCAPABILITY_NOTAUTH, "" }, 00078 { Q850_CAUSE_BEARERCAPABILITY_NOTAVAIL, "Bearer capability not available" }, 00079 { Q850_CAUSE_SERVICE_UNAVAILABLE, "Service unavailable" }, 00080 { Q850_CAUSE_BEARERCAPABILITY_NOTIMPL, "Bearer capability not implemented" }, 00081 { Q850_CAUSE_CHAN_NOT_IMPLEMENTED, "Channel not implemented" }, 00082 { Q850_CAUSE_FACILITY_NOT_IMPLEMENTED, "Facility not implemented" }, 00083 { Q850_CAUSE_SERVICE_NOT_IMPLEMENTED, "Service not implemented" }, 00084 { Q850_CAUSE_INVALID_CALL_REFERENCE, "Invalid call reference" }, 00085 { Q850_CAUSE_INCOMPATIBLE_DESTINATION, "Incompatible destination" }, 00086 { Q850_CAUSE_INVALID_MSG_UNSPECIFIED, "Message, unspecified" }, 00087 { Q850_CAUSE_MANDATORY_IE_MISSING, "Mandatory IE missing" }, 00088 { Q850_CAUSE_MESSAGE_TYPE_NONEXIST, "Message type nonexistant" }, 00089 { Q850_CAUSE_WRONG_MESSAGE, "Wrong message" }, 00090 { Q850_CAUSE_IE_NONEXIST, "IE nonexistant" }, 00091 { Q850_CAUSE_INVALID_IE_CONTENTS, "Invalid IE content" }, 00092 { Q850_CAUSE_WRONG_CALL_STATE, "Wrong call state" }, 00093 { Q850_CAUSE_RECOVERY_ON_TIMER_EXPIRE, "Recovery on timer expire" }, 00094 { Q850_CAUSE_MANDATORY_IE_LENGTH_ERROR, "Mandatory IE length error" }, 00095 { Q850_CAUSE_PROTOCOL_ERROR, "Protocol error" }, 00096 { Q850_CAUSE_INTERWORKING, "Interworking, unspecified" }, 00097 00098 { 0, NULL } 00099 }; 00100 00101 00102 const char *Q850CauseGetName(const int cause) 00103 { 00104 struct Q850CauseName *ptr = Q850CauseNames; 00105 00106 while (ptr->name) { 00107 if (ptr->id == cause) { 00108 return ptr->name; 00109 } 00110 ptr++; 00111 } 00112 return "Unknown"; 00113 }