[asterisk-commits] oej: branch oej/earl-grey-sip2cause-configurable-1.8 r376757 - in /team/oej/e...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Nov 28 14:31:26 CST 2012


Author: oej
Date: Wed Nov 28 14:31:21 2012
New Revision: 376757

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=376757
Log:
Well, it compiles. Will try this out on the flight home tomorrow. 

Added:
    team/oej/earl-grey-sip2cause-configurable-1.8/configs/sip2cause.conf.sample   (with props)
Modified:
    team/oej/earl-grey-sip2cause-configurable-1.8/README.earl-grey
    team/oej/earl-grey-sip2cause-configurable-1.8/channels/chan_sip.c
    team/oej/earl-grey-sip2cause-configurable-1.8/channels/sip/include/sip2cause.h
    team/oej/earl-grey-sip2cause-configurable-1.8/channels/sip/sip2cause.c

Modified: team/oej/earl-grey-sip2cause-configurable-1.8/README.earl-grey
URL: http://svnview.digium.com/svn/asterisk/team/oej/earl-grey-sip2cause-configurable-1.8/README.earl-grey?view=diff&rev=376757&r1=376756&r2=376757
==============================================================================
--- team/oej/earl-grey-sip2cause-configurable-1.8/README.earl-grey (original)
+++ team/oej/earl-grey-sip2cause-configurable-1.8/README.earl-grey Wed Nov 28 14:31:21 2012
@@ -17,4 +17,16 @@
 This branch will make the table a configurable option and add a new configuration
 file, sip2cause.conf, that is not needed in normal usage of Asterisk.
 
+When do you need this?
+======================
+If you operate a SIP2ISDN gateway and need to fine-tune conversion between ISDN
+cause codes and Asterisk SIP channel responses, you need a dynamic way to 
+handle the conversion. 
 
+If you operate a SIP server outside of Asterisk, you might want to add extra
+non-standard SIP response codes that is converted to a separate cause code
+that you handle in the dial plan.
+
+Please note the warning in sip2cause.conf.sample. Changing the conversion table
+can lead to all kinds of damage to your Asterisk installation. In most cases,
+no animals will be hurt.

Modified: team/oej/earl-grey-sip2cause-configurable-1.8/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/earl-grey-sip2cause-configurable-1.8/channels/chan_sip.c?view=diff&rev=376757&r1=376756&r2=376757
==============================================================================
--- team/oej/earl-grey-sip2cause-configurable-1.8/channels/chan_sip.c (original)
+++ team/oej/earl-grey-sip2cause-configurable-1.8/channels/chan_sip.c Wed Nov 28 14:31:21 2012
@@ -579,6 +579,8 @@
 
 static const char config[] = "sip.conf";                /*!< Main configuration file */
 static const char notify_config[] = "sip_notify.conf";  /*!< Configuration file for sending Notify with CLI commands to reconfigure or reboot phones */
+static const char sip2cause_config[] = "sip2cause.conf";  /*!< Configuration file for configuration of sip2cause conversions */
+static struct ast_config *sip2cause = NULL;    /*!< Configuration file for sip2cause conversions */
 
 /*! \brief Readable descriptions of device states.
  *  \note Should be aligned to above table as index */
@@ -685,6 +687,7 @@
 static char default_notifymime[AST_MAX_EXTENSION]; /*!< Default MIME media type for MWI notify messages */
 static char default_vmexten[AST_MAX_EXTENSION];    /*!< Default From Username on MWI updates */
 static int default_qualify;                        /*!< Default Qualify= setting */
+static int private_sip2cause;			   /*!< Indication of private sip2cause conversion tables */
 static char default_mohinterpret[MAX_MUSICCLASS];  /*!< Global setting for moh class to use when put on hold */
 static char default_mohsuggest[MAX_MUSICCLASS];    /*!< Global setting for moh class to suggest when putting
                                                     *   a bridged channel on hold */
@@ -18525,6 +18528,7 @@
 	ast_cli(a->fd, "  MWI NOTIFY mime type:   %s\n", default_notifymime);
 	ast_cli(a->fd, "  DNS SRV lookup:         %s\n", AST_CLI_YESNO(sip_cfg.srvlookup));
 	ast_cli(a->fd, "  Pedantic SIP support:   %s\n", AST_CLI_YESNO(sip_cfg.pedanticsipchecking));
+	ast_cli(a->fd, "  Private SIP2cause:      %s\n", AST_CLI_YESNO(private_sip2cause));
 	ast_cli(a->fd, "  Reg. min duration       %d secs\n", min_expiry);
 	ast_cli(a->fd, "  Reg. max duration:      %d secs\n", max_expiry);
 	ast_cli(a->fd, "  Reg. default duration:  %d secs\n", default_expiry);
@@ -29382,6 +29386,17 @@
 		ast_log(LOG_ERROR, "Contents of %s are invalid and cannot be parsed.\n", notify_config);
 		notify_types = NULL;
 	}
+	private_sip2cause = 0;
+	if ((sip2cause = ast_config_load(sip2cause_config, config_flags)) == CONFIG_STATUS_FILEINVALID) {
+		ast_log(LOG_ERROR, "Contents of %s are invalid and cannot be parsed.\n", sip2cause_config);
+		sip2cause = NULL;
+	} else {
+		if(sip2cause != NULL) {
+			private_sip2cause = sip2cause_load(sip2cause);
+		}
+		/* Now clean up */
+		ast_config_destroy(sip2cause);
+	}
 
 	/* Done, tell the manager */
 	manager_event(EVENT_FLAG_SYSTEM, "ChannelReload", "ChannelType: SIP\r\nReloadReason: %s\r\nRegistry_Count: %d\r\nPeer_Count: %d\r\n", channelreloadreason2txt(reason), registry_count, peer_count);

Modified: team/oej/earl-grey-sip2cause-configurable-1.8/channels/sip/include/sip2cause.h
URL: http://svnview.digium.com/svn/asterisk/team/oej/earl-grey-sip2cause-configurable-1.8/channels/sip/include/sip2cause.h?view=diff&rev=376757&r1=376756&r2=376757
==============================================================================
--- team/oej/earl-grey-sip2cause-configurable-1.8/channels/sip/include/sip2cause.h (original)
+++ team/oej/earl-grey-sip2cause-configurable-1.8/channels/sip/include/sip2cause.h Wed Nov 28 14:31:21 2012
@@ -36,5 +36,7 @@
 /*! \brief Free sip2cause tables */
 void sip2cause_free(void);
 
+/*! \brief Load configuration */
+int sip2cause_load(struct ast_config *s2c_config);
 
 #endif /* defined(_SIP_CAUSE_H) */

Modified: team/oej/earl-grey-sip2cause-configurable-1.8/channels/sip/sip2cause.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/earl-grey-sip2cause-configurable-1.8/channels/sip/sip2cause.c?view=diff&rev=376757&r1=376756&r2=376757
==============================================================================
--- team/oej/earl-grey-sip2cause-configurable-1.8/channels/sip/sip2cause.c (original)
+++ team/oej/earl-grey-sip2cause-configurable-1.8/channels/sip/sip2cause.c Wed Nov 28 14:31:21 2012
@@ -35,7 +35,8 @@
 struct sip2causestruct {
 	int	sip;			/*!< SIP code (200-699) - no provisional codes */
 	int	cause;			/*!< ISDN cause code */
-	char	*reason;		/*!< SIP reason text, like "Busy", "Inte min domän" or "Que?" */
+	char	*reason;		/*!< SIP reason text, like "486 Busy", "404 Inte min domän" or "500 Que?" */
+	int	private;		/*!< If 1 = private extension */
 	struct sip2causestruct *next;	/*!< Pointer to next entry */
 };
 
@@ -52,7 +53,8 @@
 /*! \brief Actual table for ISDN => sip lookups */
 struct sip2causetable cause2siplookup;
 
-static struct sip2causestruct *newsip2cause(int sip, int cause, char *reason, struct sip2causestruct *next)
+/*! \brief Add conversion entry to table */
+static struct sip2causestruct *newsip2cause(int sip, int cause, char *reason, int private, struct sip2causestruct *next)
 {
 	struct sip2causestruct *s2c = ast_calloc(1, sizeof(struct sip2causestruct));
 
@@ -70,60 +72,60 @@
 void sip2cause_init(void)
 {
 	/* Initialize table for SIP => ISDN codes */
-	sip2causelookup.table = newsip2cause(401, /* Unauthorized */ AST_CAUSE_CALL_REJECTED, "", NULL);
-	sip2causelookup.table = newsip2cause(403, /* Not found */ AST_CAUSE_CALL_REJECTED, "", sip2causelookup.table);
-	sip2causelookup.table = newsip2cause(404, /* Not found */ AST_CAUSE_UNALLOCATED, "", sip2causelookup.table);
-	sip2causelookup.table = newsip2cause(405, /* Method not allowed */ AST_CAUSE_INTERWORKING, "", sip2causelookup.table);
-	sip2causelookup.table = newsip2cause(407, /* Proxy authentication required */ AST_CAUSE_CALL_REJECTED, "", sip2causelookup.table);
-	sip2causelookup.table = newsip2cause(408, /* No reaction */ AST_CAUSE_NO_USER_RESPONSE, "", sip2causelookup.table);
-	sip2causelookup.table = newsip2cause(409, /* Conflict */ AST_CAUSE_NORMAL_TEMPORARY_FAILURE, "", sip2causelookup.table);
-	sip2causelookup.table = newsip2cause(410, /* Gone */ AST_CAUSE_NUMBER_CHANGED, "", sip2causelookup.table);
-	sip2causelookup.table = newsip2cause(411, /* Length required */ AST_CAUSE_INTERWORKING, "", sip2causelookup.table);
-	sip2causelookup.table = newsip2cause(413, /* Request entity too large */ AST_CAUSE_INTERWORKING, "", sip2causelookup.table);
-	sip2causelookup.table = newsip2cause(414, /* Request URI too large */ AST_CAUSE_INTERWORKING, "", sip2causelookup.table);
-	sip2causelookup.table = newsip2cause(415, /* Unsupported media type */ AST_CAUSE_INTERWORKING, "", sip2causelookup.table);
-	sip2causelookup.table = newsip2cause(420, /* Bad extension */ AST_CAUSE_NO_ROUTE_DESTINATION, "", sip2causelookup.table);
-	sip2causelookup.table = newsip2cause(480, /* No answer */ AST_CAUSE_NO_ANSWER, "", sip2causelookup.table);
-	sip2causelookup.table = newsip2cause(481, /* No answer */ AST_CAUSE_INTERWORKING, "", sip2causelookup.table);
-	sip2causelookup.table = newsip2cause(482, /* Loop detected */ AST_CAUSE_INTERWORKING, "", sip2causelookup.table);
-	sip2causelookup.table = newsip2cause(483, /* Too many hops */ AST_CAUSE_NO_ANSWER, "", sip2causelookup.table);
-	sip2causelookup.table = newsip2cause(484, /* Address incomplete */ AST_CAUSE_INVALID_NUMBER_FORMAT, "", sip2causelookup.table);
-	sip2causelookup.table = newsip2cause(485, /* Ambiguous */ AST_CAUSE_UNALLOCATED, "", sip2causelookup.table);
-	sip2causelookup.table = newsip2cause(486, /* Busy everywhere */ AST_CAUSE_BUSY, "", sip2causelookup.table);
-	sip2causelookup.table = newsip2cause(487, /* Request terminated */ AST_CAUSE_INTERWORKING, "", sip2causelookup.table);
-	sip2causelookup.table = newsip2cause(488, /* No codecs approved */ AST_CAUSE_BEARERCAPABILITY_NOTAVAIL, "", sip2causelookup.table);
-	sip2causelookup.table = newsip2cause(491, /* Request pending */ AST_CAUSE_INTERWORKING, "", sip2causelookup.table);
-	sip2causelookup.table = newsip2cause(493, /* Undecipherable */ AST_CAUSE_INTERWORKING, "", sip2causelookup.table);
-	sip2causelookup.table = newsip2cause(500, /* Server internal failure */ AST_CAUSE_FAILURE, "", sip2causelookup.table);
-	sip2causelookup.table = newsip2cause(501, /* Call rejected */ AST_CAUSE_FACILITY_REJECTED, "", sip2causelookup.table);
-	sip2causelookup.table = newsip2cause(502, AST_CAUSE_DESTINATION_OUT_OF_ORDER, "", sip2causelookup.table);
-	sip2causelookup.table = newsip2cause(503, /* Service unavailable */ AST_CAUSE_CONGESTION, "", sip2causelookup.table);
-	sip2causelookup.table = newsip2cause(504, /* Gateway timeout */ AST_CAUSE_RECOVERY_ON_TIMER_EXPIRE, "", sip2causelookup.table);
-	sip2causelookup.table = newsip2cause(505, /* SIP version not supported */ AST_CAUSE_INTERWORKING, "", sip2causelookup.table);
-	sip2causelookup.table = newsip2cause(600, /* Busy everywhere */ AST_CAUSE_USER_BUSY, "", sip2causelookup.table);
-	sip2causelookup.table = newsip2cause(603, /* Decline */ AST_CAUSE_CALL_REJECTED, "", sip2causelookup.table);
-	sip2causelookup.table = newsip2cause(604, /* Does not exist anywhere */ AST_CAUSE_UNALLOCATED, "", sip2causelookup.table);
-	sip2causelookup.table = newsip2cause(606, /* Not acceptable */ AST_CAUSE_BEARERCAPABILITY_NOTAVAIL, "", sip2causelookup.table);
+	sip2causelookup.table = newsip2cause(401, /* Unauthorized */ AST_CAUSE_CALL_REJECTED, "", 0, NULL);
+	sip2causelookup.table = newsip2cause(403, /* Not found */ AST_CAUSE_CALL_REJECTED, "", 0, sip2causelookup.table);
+	sip2causelookup.table = newsip2cause(404, /* Not found */ AST_CAUSE_UNALLOCATED, "", 0, sip2causelookup.table);
+	sip2causelookup.table = newsip2cause(405, /* Method not allowed */ AST_CAUSE_INTERWORKING, "", 0, sip2causelookup.table);
+	sip2causelookup.table = newsip2cause(407, /* Proxy authentication required */ AST_CAUSE_CALL_REJECTED, "", 0, sip2causelookup.table);
+	sip2causelookup.table = newsip2cause(408, /* No reaction */ AST_CAUSE_NO_USER_RESPONSE, "", 0, sip2causelookup.table);
+	sip2causelookup.table = newsip2cause(409, /* Conflict */ AST_CAUSE_NORMAL_TEMPORARY_FAILURE, "", 0, sip2causelookup.table);
+	sip2causelookup.table = newsip2cause(410, /* Gone */ AST_CAUSE_NUMBER_CHANGED, "", 0, sip2causelookup.table);
+	sip2causelookup.table = newsip2cause(411, /* Length required */ AST_CAUSE_INTERWORKING, "", 0, sip2causelookup.table);
+	sip2causelookup.table = newsip2cause(413, /* Request entity too large */ AST_CAUSE_INTERWORKING, "", 0, sip2causelookup.table);
+	sip2causelookup.table = newsip2cause(414, /* Request URI too large */ AST_CAUSE_INTERWORKING, "", 0, sip2causelookup.table);
+	sip2causelookup.table = newsip2cause(415, /* Unsupported media type */ AST_CAUSE_INTERWORKING, "", 0, sip2causelookup.table);
+	sip2causelookup.table = newsip2cause(420, /* Bad extension */ AST_CAUSE_NO_ROUTE_DESTINATION, "", 0, sip2causelookup.table);
+	sip2causelookup.table = newsip2cause(480, /* No answer */ AST_CAUSE_NO_ANSWER, "", 0, sip2causelookup.table);
+	sip2causelookup.table = newsip2cause(481, /* No answer */ AST_CAUSE_INTERWORKING, "", 0, sip2causelookup.table);
+	sip2causelookup.table = newsip2cause(482, /* Loop detected */ AST_CAUSE_INTERWORKING, "", 0, sip2causelookup.table);
+	sip2causelookup.table = newsip2cause(483, /* Too many hops */ AST_CAUSE_NO_ANSWER, "", 0, sip2causelookup.table);
+	sip2causelookup.table = newsip2cause(484, /* Address incomplete */ AST_CAUSE_INVALID_NUMBER_FORMAT, "", 0, sip2causelookup.table);
+	sip2causelookup.table = newsip2cause(485, /* Ambiguous */ AST_CAUSE_UNALLOCATED, "", 0, sip2causelookup.table);
+	sip2causelookup.table = newsip2cause(486, /* Busy everywhere */ AST_CAUSE_BUSY, "", 0, sip2causelookup.table);
+	sip2causelookup.table = newsip2cause(487, /* Request terminated */ AST_CAUSE_INTERWORKING, "", 0, sip2causelookup.table);
+	sip2causelookup.table = newsip2cause(488, /* No codecs approved */ AST_CAUSE_BEARERCAPABILITY_NOTAVAIL, "", 0, sip2causelookup.table);
+	sip2causelookup.table = newsip2cause(491, /* Request pending */ AST_CAUSE_INTERWORKING, "", 0, sip2causelookup.table);
+	sip2causelookup.table = newsip2cause(493, /* Undecipherable */ AST_CAUSE_INTERWORKING, "", 0, sip2causelookup.table);
+	sip2causelookup.table = newsip2cause(500, /* Server internal failure */ AST_CAUSE_FAILURE, "", 0, sip2causelookup.table);
+	sip2causelookup.table = newsip2cause(501, /* Call rejected */ AST_CAUSE_FACILITY_REJECTED, "", 0, sip2causelookup.table);
+	sip2causelookup.table = newsip2cause(502, AST_CAUSE_DESTINATION_OUT_OF_ORDER, "", 0, sip2causelookup.table);
+	sip2causelookup.table = newsip2cause(503, /* Service unavailable */ AST_CAUSE_CONGESTION, "", 0, sip2causelookup.table);
+	sip2causelookup.table = newsip2cause(504, /* Gateway timeout */ AST_CAUSE_RECOVERY_ON_TIMER_EXPIRE, "", 0, sip2causelookup.table);
+	sip2causelookup.table = newsip2cause(505, /* SIP version not supported */ AST_CAUSE_INTERWORKING, "", 0, sip2causelookup.table);
+	sip2causelookup.table = newsip2cause(600, /* Busy everywhere */ AST_CAUSE_USER_BUSY, "", 0, sip2causelookup.table);
+	sip2causelookup.table = newsip2cause(603, /* Decline */ AST_CAUSE_CALL_REJECTED, "", 0, sip2causelookup.table);
+	sip2causelookup.table = newsip2cause(604, /* Does not exist anywhere */ AST_CAUSE_UNALLOCATED, "", 0, sip2causelookup.table);
+	sip2causelookup.table = newsip2cause(606, /* Not acceptable */ AST_CAUSE_BEARERCAPABILITY_NOTAVAIL, "", 0, sip2causelookup.table);
 
 	/* Add the reverse table */
-	cause2siplookup.table = newsip2cause(404, AST_CAUSE_UNALLOCATED, "404 Not Found", NULL);
-	cause2siplookup.table = newsip2cause(404, AST_CAUSE_NO_ROUTE_DESTINATION, "404 Not Found", cause2siplookup.table);
-	cause2siplookup.table = newsip2cause(404, AST_CAUSE_NO_ROUTE_TRANSIT_NET, "404 Not Found", cause2siplookup.table);
-	cause2siplookup.table = newsip2cause(503, AST_CAUSE_CONGESTION, "503 Service Unavailable", cause2siplookup.table);
-	cause2siplookup.table = newsip2cause(503, AST_CAUSE_SWITCH_CONGESTION, "503 Service Unavailable", cause2siplookup.table);
-	cause2siplookup.table = newsip2cause(408, AST_CAUSE_NO_USER_RESPONSE, "408 Request Timeout", cause2siplookup.table);
-	cause2siplookup.table = newsip2cause(480, AST_CAUSE_NO_ANSWER, "480 Temporarily unavailable", cause2siplookup.table);
-	cause2siplookup.table = newsip2cause(480, AST_CAUSE_UNREGISTERED, "480 Temporarily unavailable", cause2siplookup.table);
-	cause2siplookup.table = newsip2cause(403, AST_CAUSE_CALL_REJECTED, "403 Forbidden", cause2siplookup.table);
-	cause2siplookup.table = newsip2cause(410, AST_CAUSE_NUMBER_CHANGED, "410 Gone", cause2siplookup.table);
-	cause2siplookup.table = newsip2cause(480, AST_CAUSE_NORMAL_UNSPECIFIED, "480 Temporarily unavailable", cause2siplookup.table);
-	cause2siplookup.table = newsip2cause(484, AST_CAUSE_INVALID_NUMBER_FORMAT, "484 Address Incomplete", cause2siplookup.table);
-	cause2siplookup.table = newsip2cause(486, AST_CAUSE_USER_BUSY, "486 Busy here", cause2siplookup.table);
-	cause2siplookup.table = newsip2cause(500, AST_CAUSE_FAILURE, "500 Server internal failure", cause2siplookup.table);
-	cause2siplookup.table = newsip2cause(501, AST_CAUSE_FACILITY_REJECTED, "501 Not implemented", cause2siplookup.table);
-	cause2siplookup.table = newsip2cause(503, AST_CAUSE_CHAN_NOT_IMPLEMENTED, "503 Service unavailable", cause2siplookup.table);
-	cause2siplookup.table = newsip2cause(502, AST_CAUSE_DESTINATION_OUT_OF_ORDER, "502 Bad gateway", cause2siplookup.table);
-	cause2siplookup.table = newsip2cause(488, AST_CAUSE_BEARERCAPABILITY_NOTAVAIL, "488 Not Acceptable Here", cause2siplookup.table);
+	cause2siplookup.table = newsip2cause(404, AST_CAUSE_UNALLOCATED, "404 Not Found", 0, NULL);
+	cause2siplookup.table = newsip2cause(404, AST_CAUSE_NO_ROUTE_DESTINATION, "404 Not Found", 0, cause2siplookup.table);
+	cause2siplookup.table = newsip2cause(404, AST_CAUSE_NO_ROUTE_TRANSIT_NET, "404 Not Found", 0, cause2siplookup.table);
+	cause2siplookup.table = newsip2cause(503, AST_CAUSE_CONGESTION, "503 Service Unavailable", 0, cause2siplookup.table);
+	cause2siplookup.table = newsip2cause(503, AST_CAUSE_SWITCH_CONGESTION, "503 Service Unavailable", 0, cause2siplookup.table);
+	cause2siplookup.table = newsip2cause(408, AST_CAUSE_NO_USER_RESPONSE, "408 Request Timeout", 0, cause2siplookup.table);
+	cause2siplookup.table = newsip2cause(480, AST_CAUSE_NO_ANSWER, "480 Temporarily unavailable", 0, cause2siplookup.table);
+	cause2siplookup.table = newsip2cause(480, AST_CAUSE_UNREGISTERED, "480 Temporarily unavailable", 0, cause2siplookup.table);
+	cause2siplookup.table = newsip2cause(403, AST_CAUSE_CALL_REJECTED, "403 Forbidden", 0, cause2siplookup.table);
+	cause2siplookup.table = newsip2cause(410, AST_CAUSE_NUMBER_CHANGED, "410 Gone", 0, cause2siplookup.table);
+	cause2siplookup.table = newsip2cause(480, AST_CAUSE_NORMAL_UNSPECIFIED, "480 Temporarily unavailable", 0, cause2siplookup.table);
+	cause2siplookup.table = newsip2cause(484, AST_CAUSE_INVALID_NUMBER_FORMAT, "484 Address Incomplete", 0, cause2siplookup.table);
+	cause2siplookup.table = newsip2cause(486, AST_CAUSE_USER_BUSY, "486 Busy here", 0, cause2siplookup.table);
+	cause2siplookup.table = newsip2cause(500, AST_CAUSE_FAILURE, "500 Server internal failure", 0, cause2siplookup.table);
+	cause2siplookup.table = newsip2cause(501, AST_CAUSE_FACILITY_REJECTED, "501 Not implemented", 0, cause2siplookup.table);
+	cause2siplookup.table = newsip2cause(503, AST_CAUSE_CHAN_NOT_IMPLEMENTED, "503 Service unavailable", 0, cause2siplookup.table);
+	cause2siplookup.table = newsip2cause(502, AST_CAUSE_DESTINATION_OUT_OF_ORDER, "502 Bad gateway", 0, cause2siplookup.table);
+	cause2siplookup.table = newsip2cause(488, AST_CAUSE_BEARERCAPABILITY_NOTAVAIL, "488 Not Acceptable Here", 0, cause2siplookup.table);
 
 }
 	
@@ -216,3 +218,17 @@
 	ast_debug(1, "AST hangup cause %d (no match found in SIP)\n", cause);
 	return NULL;
 }
+
+int sip2cause_load(struct ast_config *s2c_config)
+{
+	struct ast_variable *v;
+
+	ast_debug(2, "AST sip2cause configuration parser");
+	for (v = ast_variable_browse(s2c_config, "sip2cause"); v; v = v->next) {
+		ast_debug(1, "====> SIP2cause ::: Name %s Value %s \n", v->name, v->value);
+	}
+	for (v = ast_variable_browse(s2c_config, "cause2sip"); v; v = v->next) {
+		ast_debug(1, "====> CAUSE2SIP ::: Name %s Value %s \n", v->name, v->value);
+	}
+	return 1;
+}

Added: team/oej/earl-grey-sip2cause-configurable-1.8/configs/sip2cause.conf.sample
URL: http://svnview.digium.com/svn/asterisk/team/oej/earl-grey-sip2cause-configurable-1.8/configs/sip2cause.conf.sample?view=auto&rev=376757
==============================================================================
--- team/oej/earl-grey-sip2cause-configurable-1.8/configs/sip2cause.conf.sample (added)
+++ team/oej/earl-grey-sip2cause-configurable-1.8/configs/sip2cause.conf.sample Wed Nov 28 14:31:21 2012
@@ -1,0 +1,17 @@
+;
+; Conversion table additions for the translation between SIP hangup codes and ISDN cause codes
+; For reference, check Asterisk source code include/asterisk/causes.h
+; and channels/sip/sip2cause.c
+; Note also that this translation is not used in all cases in the SIP implementation in Asterisk.
+; Fixes are always welcome.
+;
+; !!!!!!!!!!!!!!!!!!!! READ THIS SERIOUSLY !
+; Note: By changing the default translation, you can seriously jeopardize your Asterisk server functionality.
+;       Make sure you understand what you are doing, and that you are testing carefully.
+;       In 99.99% of Asterisk installations, you will not need to add ANYTHING to this file.
+;
+[sip2cause]
+; 200 => AST_CAUSE_NORMAL_CLEARING
+
+[cause2sip]
+; AST_CAUSE_NORMAL_CLEARING => 200 All right, dude

Propchange: team/oej/earl-grey-sip2cause-configurable-1.8/configs/sip2cause.conf.sample
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: team/oej/earl-grey-sip2cause-configurable-1.8/configs/sip2cause.conf.sample
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: team/oej/earl-grey-sip2cause-configurable-1.8/configs/sip2cause.conf.sample
------------------------------------------------------------------------------
    svn:mime-type = text/plain




More information about the asterisk-commits mailing list