[asterisk-commits] branch oej/test-this-branch r12571 - in /team/oej/test-this-branch: ./ cdr/ c...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Sun Mar 12 10:23:23 MST 2006


Author: oej
Date: Sun Mar 12 11:23:11 2006
New Revision: 12571

URL: http://svn.digium.com/view/asterisk?rev=12571&view=rev
Log:
Resolve conflict, reset automerge

Modified:
    team/oej/test-this-branch/   (props changed)
    team/oej/test-this-branch/README
    team/oej/test-this-branch/UPGRADE.txt
    team/oej/test-this-branch/ast_expr2.fl
    team/oej/test-this-branch/ast_expr2f.c
    team/oej/test-this-branch/cdr/cdr_tds.c
    team/oej/test-this-branch/channels/chan_iax2.c
    team/oej/test-this-branch/channels/chan_misdn.c
    team/oej/test-this-branch/channels/chan_sip.c
    team/oej/test-this-branch/channels/misdn/chan_misdn_config.h
    team/oej/test-this-branch/channels/misdn/isdn_lib.c
    team/oej/test-this-branch/channels/misdn/isdn_lib.h
    team/oej/test-this-branch/channels/misdn/isdn_msg_parser.c
    team/oej/test-this-branch/channels/misdn_config.c
    team/oej/test-this-branch/configs/cdr_tds.conf.sample
    team/oej/test-this-branch/configs/misdn.conf.sample
    team/oej/test-this-branch/doc/asterisk-mib.txt
    team/oej/test-this-branch/doc/misdn.txt
    team/oej/test-this-branch/include/asterisk/doxyref.h
    team/oej/test-this-branch/include/asterisk/sched.h
    team/oej/test-this-branch/sched.c

Propchange: team/oej/test-this-branch/
------------------------------------------------------------------------------
    automerge = http://edvina.net

Propchange: team/oej/test-this-branch/
------------------------------------------------------------------------------
Binary property 'branch-1.2-merged' - no diff available.

Propchange: team/oej/test-this-branch/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Sun Mar 12 11:23:11 2006
@@ -1,1 +1,1 @@
-/trunk:1-12452
+/trunk:1-12545

Modified: team/oej/test-this-branch/README
URL: http://svn.digium.com/view/asterisk/team/oej/test-this-branch/README?rev=12571&r1=12570&r2=12571&view=diff
==============================================================================
--- team/oej/test-this-branch/README (original)
+++ team/oej/test-this-branch/README Sun Mar 12 11:23:11 2006
@@ -51,13 +51,15 @@
 	* All Wildcard (tm) products from Digium (www.digium.com)
 	* QuickNet Internet PhoneJack and LineJack (http://www.quicknet.net)
 	* any full duplex sound card supported by ALSA or OSS
+	* any ISDN card supported by mISDN on Linux (BRI)
+	* The Xorcom AstriBank channel bank
         * VoiceTronix OpenLine products
 
 The are several drivers for ISDN BRI cards available from third party sources.
-Check the voip-info.org wiki for more information on chan_capi, chan_misdn and 
+Check the voip-info.org wiki for more information on chan_capi and 
 zaphfc.
 
-* UPGRADING FROM VERSION 1.0
+* UPGRADING FROM AN EARLIER VERSION
 
   If you are updating from a previous version of Asterisk, make sure you
 read the UPGRADE.txt file in the source directory. There are some files

Modified: team/oej/test-this-branch/UPGRADE.txt
URL: http://svn.digium.com/view/asterisk/team/oej/test-this-branch/UPGRADE.txt?rev=12571&r1=12570&r2=12571&view=diff
==============================================================================
--- team/oej/test-this-branch/UPGRADE.txt (original)
+++ team/oej/test-this-branch/UPGRADE.txt Sun Mar 12 11:23:11 2006
@@ -61,7 +61,7 @@
 
 Installation:
 
-* On BSD systems, the installation directories have changed to more "FreeBSDish" directories. On startup, Asterisk will look for the main configuration in /usr7local/etc/asterisk/asterisk.conf
+* On BSD systems, the installation directories have changed to more "FreeBSDish" directories. On startup, Asterisk will look for the main configuration in /usr/local/etc/asterisk/asterisk.conf
 If you have an old installation, you might want to remove the binaries and move the configuration files to the new locations. The following directories are now default:
 	ASTLIBDIR	/usr/local/lib/asterisk
 	ASTVARLIBDIR	/usr/local/share/asterisk

Modified: team/oej/test-this-branch/ast_expr2.fl
URL: http://svn.digium.com/view/asterisk/team/oej/test-this-branch/ast_expr2.fl?rev=12571&r1=12570&r2=12571&view=diff
==============================================================================
--- team/oej/test-this-branch/ast_expr2.fl (original)
+++ team/oej/test-this-branch/ast_expr2.fl Sun Mar 12 11:23:11 2006
@@ -201,7 +201,7 @@
 			s, parseio->string,spacebuf2);
 #endif
 #ifndef STANDALONE
-	ast_log(LOG_WARNING,"If you have questions, please refer to doc/README.variables in the asterisk source.\n");
+	ast_log(LOG_WARNING,"If you have questions, please refer to doc/channelvariables.txt in the asterisk source.\n");
 #endif
 	return(0);
 }

Modified: team/oej/test-this-branch/ast_expr2f.c
URL: http://svn.digium.com/view/asterisk/team/oej/test-this-branch/ast_expr2f.c?rev=12571&r1=12570&r2=12571&view=diff
==============================================================================
--- team/oej/test-this-branch/ast_expr2f.c (original)
+++ team/oej/test-this-branch/ast_expr2f.c Sun Mar 12 11:23:11 2006
@@ -2981,7 +2981,7 @@
 			s, parseio->string,spacebuf2);
 #endif
 #ifndef STANDALONE
-	ast_log(LOG_WARNING,"If you have questions, please refer to doc/README.variables in the asterisk source.\n");
+	ast_log(LOG_WARNING,"If you have questions, please refer to doc/channelvariables.txt in the asterisk source.\n");
 #endif
 	return(0);
 }

Modified: team/oej/test-this-branch/cdr/cdr_tds.c
URL: http://svn.digium.com/view/asterisk/team/oej/test-this-branch/cdr/cdr_tds.c?rev=12571&r1=12570&r2=12571&view=diff
==============================================================================
--- team/oej/test-this-branch/cdr/cdr_tds.c (original)
+++ team/oej/test-this-branch/cdr/cdr_tds.c Sun Mar 12 11:23:11 2006
@@ -89,6 +89,7 @@
 static char *config = "cdr_tds.conf";
 
 static char *hostname = NULL, *dbname = NULL, *dbuser = NULL, *password = NULL, *charset = NULL, *language = NULL;
+static char *table = NULL;
 
 static int connected = 0;
 
@@ -135,7 +136,7 @@
 
 	sprintf(
 		sqlcmd,
-		"INSERT INTO cdr "
+		"INSERT INTO %s "
 		"("
 			"accountcode, "
 			"src, "
@@ -175,6 +176,7 @@
 			"'%s', "	/* amaflags */
 			"'%s'"		/* uniqueid */
 		")",
+		table,
 		accountcode,
 		src,
 		dst,
@@ -415,6 +417,7 @@
 	if (password) free(password);
 	if (charset) free(charset);
 	if (language) free(language);
+	if (table) free(table);
 
 	return 0;
 }
@@ -475,6 +478,13 @@
 	else
 		language = strdup("us_english");
 
+	ptr = ast_variable_retrieve(cfg,"global","table");
+	if (ptr == NULL) {
+		ast_log(LOG_DEBUG,"cdr_tds: table not specified.  Assuming cdr\n");
+		ptr = "cdr";
+	}
+	table = strdup(ptr);
+
 	ast_config_destroy(cfg);
 
 	mssql_connect();

Modified: team/oej/test-this-branch/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/team/oej/test-this-branch/channels/chan_iax2.c?rev=12571&r1=12570&r2=12571&view=diff
==============================================================================
--- team/oej/test-this-branch/channels/chan_iax2.c (original)
+++ team/oej/test-this-branch/channels/chan_iax2.c Sun Mar 12 11:23:11 2006
@@ -5774,8 +5774,6 @@
 	ast_log(LOG_DEBUG, "Expiring registration for peer '%s'\n", p->name);
 	/* Reset the address */
 	memset(&p->addr, 0, sizeof(p->addr));
-	/* Reset expire notice */
-	p->expire = -1;
 	/* Reset expiry value */
 	p->expiry = min_reg_expire;
 	if (!ast_test_flag(p, IAX_TEMPONLY))
@@ -5793,6 +5791,9 @@
 
 static int expire_registry(void *data)
 {
+	struct iax2_peer *p = data;
+	/* Reset expire notice */
+	p->expire = -1;
 #ifdef SCHED_MULTITHREADED
 	if (schedule_action(__expire_registry, data))
 #endif		

Modified: team/oej/test-this-branch/channels/chan_misdn.c
URL: http://svn.digium.com/view/asterisk/team/oej/test-this-branch/channels/chan_misdn.c?rev=12571&r1=12570&r2=12571&view=diff
==============================================================================
--- team/oej/test-this-branch/channels/chan_misdn.c (original)
+++ team/oej/test-this-branch/channels/chan_misdn.c Sun Mar 12 11:23:11 2006
@@ -648,13 +648,14 @@
 {
 	struct ast_channel *ast=help->ast;
 	ast_cli(fd,
-		"* Pid:%d Prt:%d Ch:%d Mode:%s Org:%s dad:%s oad:%s ctx:%s state:%s\n",
+		"* Pid:%d Prt:%d Ch:%d Mode:%s Org:%s dad:%s oad:%s rad:%s ctx:%s state:%s\n",
 
 		bc->pid, bc->port, bc->channel,
 		bc->nt?"NT":"TE",
 		help->orginator == ORG_AST?"*":"I",
 		ast?ast->exten:NULL,
 		ast?AST_CID_P(ast):NULL,
+		bc->rad,
 		ast?ast->context:NULL,
 		misdn_get_ch_state(help)
 		);
@@ -1340,26 +1341,47 @@
 			misdn_cfg_get( port, MISDN_CFG_LOCALDIALPLAN, &bc->onumplan, sizeof(int));
 			switch (bc->onumplan) {
 			case NUMPLAN_INTERNATIONAL:
-				chan_misdn_log(2, port, " --> TON: International\n");
+				chan_misdn_log(2, port, " --> LTON: International\n");
 				break;
 			case NUMPLAN_NATIONAL:
-				chan_misdn_log(2, port, " --> TON: National\n");
+				chan_misdn_log(2, port, " --> LTON: National\n");
 				break;
 			case NUMPLAN_SUBSCRIBER:
-				chan_misdn_log(2, port, " --> TON: Subscriber\n");
+				chan_misdn_log(2, port, " --> LTON: Subscriber\n");
 				break;
 			case NUMPLAN_UNKNOWN:
-				chan_misdn_log(2, port, " --> TON: Unknown\n");
+				chan_misdn_log(2, port, " --> LTON: Unknown\n");
 				break;
 				/* Maybe we should cut off the prefix if present ? */
 			default:
 					chan_misdn_log(0, port, " --> !!!! Wrong dialplan setting, please see the misdn.conf sample file\n ");
 					break;
 			}
-		}
-
-		
-				
+
+			misdn_cfg_get( port, MISDN_CFG_CPNDIALPLAN, &bc->cpnnumplan, sizeof(int));
+
+			switch (bc->cpnnumplan) {
+			case NUMPLAN_INTERNATIONAL:
+				chan_misdn_log(2, port, " --> CTON: International\n");
+				break;
+			case NUMPLAN_NATIONAL:
+				chan_misdn_log(2, port, " --> CTON: National\n");
+				break;
+			case NUMPLAN_SUBSCRIBER:
+				chan_misdn_log(2, port, " --> CTON: Subscriber\n");
+				break;
+			case NUMPLAN_UNKNOWN:
+				chan_misdn_log(2, port, " --> CTON: Unknown\n");
+				break;
+				/* Maybe we should cut off the prefix if present ? */
+			default:
+					chan_misdn_log(0, port, " --> !!!! Wrong dialplan setting, please see the misdn.conf sample file\n ");
+					break;
+			}
+
+		}
+
+		
 		
 	} else { /** ORIGINATOR MISDN **/
 		

Modified: team/oej/test-this-branch/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/oej/test-this-branch/channels/chan_sip.c?rev=12571&r1=12570&r2=12571&view=diff
==============================================================================
--- team/oej/test-this-branch/channels/chan_sip.c (original)
+++ team/oej/test-this-branch/channels/chan_sip.c Sun Mar 12 11:23:11 2006
@@ -103,6 +103,7 @@
 #ifndef TRUE
 #define TRUE 1
 #endif
+
  
 #define VIDEO_CODEC_MASK	0x1fc0000 /*!< Video codecs from H.261 thru AST_FORMAT_MAX_VIDEO */
 #ifndef IPTOS_MINCOST
@@ -189,6 +190,13 @@
 enum objecttype {
 	SIP_USER = (1 << 0),		/* USER places calls to the PBX */
 	SIP_PEER = (1 << 1),		/* Peer receives calls from PBX (and places calls) */
+};
+
+enum xmittype {
+	XMIT_CRITICAL = 2,		/*!< Transmit critical SIP message reliably, with re-transmits.
+							If it fails, it's critical and will cause a teardown of the session */
+	XMIT_RELIABLE = 1,		/*!< Transmit SIP message reliably, with re-transmits */
+	XMIT_UNRELIABLE = 0,		/*!< Transmit SIP message without bothering with re-transmits */
 };
 
 enum subscriptiontype { 
@@ -929,11 +937,11 @@
 
 /*---------------------------- Forward declarations of functions in chan_sip.c */
 static int transmit_response(struct sip_pvt *p, char *msg, struct sip_request *req);
-static int transmit_response_with_sdp(struct sip_pvt *p, char *msg, struct sip_request *req, int retrans);
+static int transmit_response_with_sdp(struct sip_pvt *p, char *msg, struct sip_request *req, enum xmittype reliable);
 static int transmit_response_with_unsupported(struct sip_pvt *p, char *msg, struct sip_request *req, char *unsupported);
-static int transmit_response_with_auth(struct sip_pvt *p, const char *msg, struct sip_request *req, const char *rand, int reliable, const char *header, int stale);
-static int transmit_request(struct sip_pvt *p, int sipmethod, int inc, int reliable, int newbranch);
-static int transmit_request_with_auth(struct sip_pvt *p, int sipmethod, int inc, int reliable, int newbranch);
+static int transmit_response_with_auth(struct sip_pvt *p, const char *msg, struct sip_request *req, const char *rand, enum xmittype reliable, const char *header, int stale);
+static int transmit_request(struct sip_pvt *p, int sipmethod, int inc, enum xmittype reliable, int newbranch);
+static int transmit_request_with_auth(struct sip_pvt *p, int sipmethod, int inc, enum xmittype reliable, int newbranch);
 static int transmit_invite(struct sip_pvt *p, int sipmethod, int sendsdp, int init);
 static int transmit_reinvite_with_sdp(struct sip_pvt *p);
 static int transmit_info_with_digit(struct sip_pvt *p, char digit);
@@ -967,7 +975,7 @@
 static struct sip_auth *find_realm_authentication(struct sip_auth *authlist, const char *realm);	/* Find authentication for a specific realm */
 static int check_auth(struct sip_pvt *p, struct sip_request *req, const char *username,
 		const char *secret, const char *md5secret, int sipmethod,
-		char *uri, int reliable, int ignore);
+		char *uri, enum xmittype reliable, int ignore);
 static int check_sip_domain(const char *domain, char *context, size_t len); /* Check if domain is one of our local domains */
 static void append_date(struct sip_request *req);	/* Append date to SIP packet */
 static int determine_firstline_parts(struct sip_request *req);
@@ -982,7 +990,7 @@
 static void parse_request(struct sip_request *req);
 static char *get_header(struct sip_request *req, const char *name);
 static void copy_request(struct sip_request *dst,struct sip_request *src);
-static int transmit_response_reliable(struct sip_pvt *p, char *msg, struct sip_request *req, int fatal);
+static int transmit_response_reliable(struct sip_pvt *p, char *msg, struct sip_request *req);
 static int transmit_register(struct sip_registry *r, int sipmethod, char *auth, char *authheader);
 static int sip_poke_peer(struct sip_peer *peer);
 static int __sip_do_register(struct sip_registry *r);
@@ -1301,7 +1309,9 @@
 	} 
 	/* Too many retries */
 	if (pkt->owner && pkt->method != SIP_OPTIONS) {
-		if (ast_test_flag(pkt, FLAG_FATAL) || sipdebug)	/* Tell us if it's critical or if we're debugging */ ast_log(LOG_WARNING, "Maximum retries exceeded on transmission %s for seqno %d (%s %s)\n", pkt->owner->callid, pkt->seqno, (ast_test_flag(pkt, FLAG_FATAL)) ? "Critical" : "Non-critical", (ast_test_flag(pkt, FLAG_RESPONSE)) ? "Response" : "Request"); } else {
+		if (ast_test_flag(pkt, FLAG_FATAL) || sipdebug)	/* Tell us if it's critical or if we're debugging */
+			ast_log(LOG_WARNING, "Maximum retries exceeded on transmission %s for seqno %d (%s %s)\n", pkt->owner->callid, pkt->seqno, (ast_test_flag(pkt, FLAG_FATAL)) ? "Critical" : "Non-critical", (ast_test_flag(pkt, FLAG_RESPONSE)) ? "Response" : "Request");
+	} else {
 		if ((pkt->method == SIP_OPTIONS) && sipdebug)
 			ast_log(LOG_WARNING, "Cancelling retransmit of OPTIONs (call id %s) \n", pkt->owner->callid);
 	}
@@ -1370,6 +1380,7 @@
 	pkt->timer_t1 = p->timer_t1;	/* Set SIP timer T1 */
 	if (fatal)
 		ast_set_flag(pkt, FLAG_FATAL);
+
 	if (pkt->timer_t1)
 		siptimer_a = pkt->timer_t1 * 2;
 
@@ -1553,7 +1564,7 @@
 }
 
 /*! \brief Transmit response on SIP request*/
-static int send_response(struct sip_pvt *p, struct sip_request *req, int reliable, int seqno)
+static int send_response(struct sip_pvt *p, struct sip_request *req, enum xmittype reliable, int seqno)
 {
 	int res;
 
@@ -1570,7 +1581,7 @@
 		append_history(p, reliable ? "TxRespRel" : "TxResp", "%s / %s", tmp.data, get_header(&tmp, "CSeq"));
 	}
 	res = (reliable) ?
-		__sip_reliable_xmit(p, seqno, 1, req->data, req->len, (reliable > 1), req->method) :
+		__sip_reliable_xmit(p, seqno, 1, req->data, req->len, (reliable == XMIT_CRITICAL), req->method) :
 		__sip_xmit(p, req->data, req->len);
 	if (res > 0)
 		return 0;
@@ -1578,7 +1589,7 @@
 }
 
 /*! \brief Send SIP Request to the other part of the dialogue */
-static int send_request(struct sip_pvt *p, struct sip_request *req, int reliable, int seqno)
+static int send_request(struct sip_pvt *p, struct sip_request *req, enum xmittype reliable, int seqno)
 {
 	int res;
 
@@ -2584,13 +2595,16 @@
 	if (!ast_test_flag(p, SIP_ALREADYGONE) && !ast_strlen_zero(p->initreq.data)) {
 		if (needcancel) {	/* Outgoing call, not up */
 			if (ast_test_flag(p, SIP_OUTGOING)) {
-				transmit_request_with_auth(p, SIP_CANCEL, p->ocseq, 1, 0);
+				/* stop retransmitting an INVITE that has not received a response */
+				__sip_pretend_ack(p);
+
+				/* Send a new request: CANCEL */
+				transmit_request_with_auth(p, SIP_CANCEL, p->ocseq, XMIT_RELIABLE, 0);
 				/* Actually don't destroy us yet, wait for the 487 on our original 
 				   INVITE, but do set an autodestruct just in case we never get it. */
 				ast_clear_flag(&locflags, SIP_NEEDDESTROY);
-				sip_scheddestroy(p, 15000);
-				/* stop retransmitting an INVITE that has not received a response */
-				__sip_pretend_ack(p);
+
+				sip_scheddestroy(p, 32000);
 				if ( p->initid != -1 ) {
 					/* channel still up - reverse dec of inUse counter
 					   only if the channel is not auto-congested */
@@ -2599,14 +2613,14 @@
 			} else {	/* Incoming call, not up */
 				char *res;
 				if (ast->hangupcause && ((res = hangup_cause2sip(ast->hangupcause)))) {
-					transmit_response_reliable(p, res, &p->initreq, 1);
+					transmit_response_reliable(p, res, &p->initreq);
 				} else 
-					transmit_response_reliable(p, "603 Declined", &p->initreq, 1);
+					transmit_response_reliable(p, "603 Declined", &p->initreq);
 			}
 		} else {	/* Call is in UP state, send BYE */
 			if (!p->pendinginvite) {
 				/* Send a hangup */
-				transmit_request_with_auth(p, SIP_BYE, 0, 1, 1);
+				transmit_request_with_auth(p, SIP_BYE, 0, XMIT_RELIABLE, 1);
 			} else {
 				/* Note we will need a BYE when this all settles out
 				   but we can't send one while we have "INVITE" outstanding. */
@@ -2661,7 +2675,7 @@
 		ast_setstate(ast, AST_STATE_UP);
 		if (option_debug)
 			ast_log(LOG_DEBUG, "SIP answering channel: %s\n", ast->name);
-		res = transmit_response_with_sdp(p, "200 OK", &p->initreq, 1);
+		res = transmit_response_with_sdp(p, "200 OK", &p->initreq, XMIT_RELIABLE);
 	}
 	ast_mutex_unlock(&p->lock);
 	return res;
@@ -2685,7 +2699,7 @@
 			if (p->rtp) {
 				/* If channel is not up, activate early media session */
 				if ((ast->_state != AST_STATE_UP) && !ast_test_flag(p, SIP_PROGRESS_SENT) && !ast_test_flag(p, SIP_OUTGOING)) {
-					transmit_response_with_sdp(p, "183 Session Progress", &p->initreq, 0);
+					transmit_response_with_sdp(p, "183 Session Progress", &p->initreq, XMIT_UNRELIABLE);
 					ast_set_flag(p, SIP_PROGRESS_SENT);	
 				}
 				time(&p->lastrtptx);
@@ -2700,7 +2714,7 @@
 			if (p->vrtp) {
 				/* Activate video early media */
 				if ((ast->_state != AST_STATE_UP) && !ast_test_flag(p, SIP_PROGRESS_SENT) && !ast_test_flag(p, SIP_OUTGOING)) {
-					transmit_response_with_sdp(p, "183 Session Progress", &p->initreq, 0);
+					transmit_response_with_sdp(p, "183 Session Progress", &p->initreq, XMIT_UNRELIABLE);
 					ast_set_flag(p, SIP_PROGRESS_SENT);	
 				}
 				time(&p->lastrtptx);
@@ -2829,7 +2843,7 @@
 		break;
 	case AST_CONTROL_PROGRESS:
 		if ((ast->_state != AST_STATE_UP) && !ast_test_flag(p, SIP_PROGRESS_SENT) && !ast_test_flag(p, SIP_OUTGOING)) {
-			transmit_response_with_sdp(p, "183 Session Progress", &p->initreq, 0);
+			transmit_response_with_sdp(p, "183 Session Progress", &p->initreq, XMIT_UNRELIABLE);
 			ast_set_flag(p, SIP_PROGRESS_SENT);	
 			break;
 		}
@@ -4340,7 +4354,7 @@
 }
 
 /*! \brief Base transmit response function */
-static int __transmit_response(struct sip_pvt *p, char *msg, struct sip_request *req, int reliable)
+static int __transmit_response(struct sip_pvt *p, char *msg, struct sip_request *req, enum xmittype reliable)
 {
 	struct sip_request resp;
 	int seqno = 0;
@@ -4363,7 +4377,7 @@
 /*! \brief Transmit response, no retransmits */
 static int transmit_response(struct sip_pvt *p, char *msg, struct sip_request *req) 
 {
-	return __transmit_response(p, msg, req, 0);
+	return __transmit_response(p, msg, req, XMIT_UNRELIABLE);
 }
 
 /*! \brief Transmit response, no retransmits */
@@ -4373,13 +4387,15 @@
 	respprep(&resp, p, msg, req);
 	append_date(&resp);
 	add_header(&resp, "Unsupported", unsupported);
-	return send_response(p, &resp, 0, 0);
-}
-
-/*! \brief Transmit response, Make sure you get a reply */
-static int transmit_response_reliable(struct sip_pvt *p, char *msg, struct sip_request *req, int fatal)
-{
-	return __transmit_response(p, msg, req, fatal ? 2 : 1);
+	return send_response(p, &resp, XMIT_UNRELIABLE, 0);
+}
+
+/*! \brief Transmit response, Make sure you get an ACK
+	This is only used for responses to INVITEs, where we need to make sure we get an ACK
+*/
+static int transmit_response_reliable(struct sip_pvt *p, char *msg, struct sip_request *req)
+{
+	return __transmit_response(p, msg, req, XMIT_CRITICAL);
 }
 
 /*! \brief Append date to SIP message */
@@ -4403,11 +4419,11 @@
 	append_date(&resp);
 	add_header_contentLength(&resp, 0);
 	add_blank_header(&resp);
-	return send_response(p, &resp, 0, 0);
+	return send_response(p, &resp, XMIT_UNRELIABLE, 0);
 }
 
 /*! \brief Append Accept header, content length before transmitting response */
-static int transmit_response_with_allow(struct sip_pvt *p, char *msg, struct sip_request *req, int reliable)
+static int transmit_response_with_allow(struct sip_pvt *p, char *msg, struct sip_request *req, enum xmittype reliable)
 {
 	struct sip_request resp;
 	respprep(&resp, p, msg, req);
@@ -4418,7 +4434,7 @@
 }
 
 /*! \brief Respond with authorization request */
-static int transmit_response_with_auth(struct sip_pvt *p, const char *msg, struct sip_request *req, const char *randdata, int reliable, const char *header, int stale)
+static int transmit_response_with_auth(struct sip_pvt *p, const char *msg, struct sip_request *req, const char *randdata, enum xmittype reliable, const char *header, int stale)
 {
 	struct sip_request resp;
 	char tmp[256];
@@ -4732,7 +4748,7 @@
 }
 
 /*! \brief Used for 200 OK and 183 early media */
-static int transmit_response_with_sdp(struct sip_pvt *p, char *msg, struct sip_request *req, int retrans)
+static int transmit_response_with_sdp(struct sip_pvt *p, char *msg, struct sip_request *req, enum xmittype reliable)
 {
 	struct sip_request resp;
 	int seqno;
@@ -4742,12 +4758,12 @@
 	}
 	respprep(&resp, p, msg, req);
 	if (p->rtp) {
-		try_suggested_sip_codec(p);
+		try_suggested_sip_codec(p);	
 		add_sdp(&resp, p);
 	} else {
 		ast_log(LOG_ERROR, "Can't add SDP to response, since we have no RTP session allocated. Call-ID %s\n", p->callid);
 	}
-	return send_response(p, &resp, retrans, seqno);
+	return send_response(p, &resp, reliable, seqno);
 }
 
 /*! \brief Parse first line of incoming SIP request */
@@ -5785,7 +5801,7 @@
 }
 
 /*! \brief Transmit generic SIP request */
-static int transmit_request(struct sip_pvt *p, int sipmethod, int seqno, int reliable, int newbranch)
+static int transmit_request(struct sip_pvt *p, int sipmethod, int seqno, enum xmittype reliable, int newbranch)
 {
 	struct sip_request resp;
 	reqprep(&resp, p, sipmethod, seqno, newbranch);
@@ -5795,7 +5811,7 @@
 }
 
 /*! \brief Transmit SIP request, auth added */
-static int transmit_request_with_auth(struct sip_pvt *p, int sipmethod, int seqno, int reliable, int newbranch)
+static int transmit_request_with_auth(struct sip_pvt *p, int sipmethod, int seqno, enum xmittype reliable, int newbranch)
 {
 	struct sip_request resp;
 
@@ -6311,7 +6327,7 @@
 */
 static int check_auth(struct sip_pvt *p, struct sip_request *req, const char *username,
 		      const char *secret, const char *md5secret, int sipmethod,
-		      char *uri, int reliable, int ignore)
+		      char *uri, enum xmittype reliable, int ignore)
 {
 	const char *response = "407 Proxy Authentication Required";
 	const char *reqheader = "Proxy-Authorization";
@@ -6589,7 +6605,7 @@
 		} else {
 			ast_copy_flags(p, peer, SIP_NAT);
 			transmit_response(p, "100 Trying", req);
-			if (!(res = check_auth(p, req, peer->name, peer->secret, peer->md5secret, SIP_REGISTER, uri, 0, ignore))) {
+			if (!(res = check_auth(p, req, peer->name, peer->secret, peer->md5secret, SIP_REGISTER, uri, XMIT_UNRELIABLE, ignore))) {
 				sip_cancel_destroy(p);
 				switch (parse_register_contact(p, peer, req)) {
 				case PARSE_REGISTER_FAILED:
@@ -7233,7 +7249,7 @@
 	\return 0 on success, -1 on failure, and 1 on challenge sent
 	-2 on authentication error from chedck_auth()
 */
-static int check_user_full(struct sip_pvt *p, struct sip_request *req, int sipmethod, char *uri, int reliable, struct sockaddr_in *sin, int ignore, struct sip_peer **authpeer)
+static int check_user_full(struct sip_pvt *p, struct sip_request *req, int sipmethod, char *uri, enum xmittype reliable, struct sockaddr_in *sin, int ignore, struct sip_peer **authpeer)
 {
 	struct sip_peer *device = NULL;
 	char *of, from[256], *c;
@@ -7481,7 +7497,7 @@
 /*! \brief  Find user 
 	If we get a match, this will add a reference pointer to the user object in ASTOBJ, that needs to be unreferenced
 */
-static int check_user(struct sip_pvt *p, struct sip_request *req, int sipmethod, char *uri, int reliable, struct sockaddr_in *sin, int ignore)
+static int check_user(struct sip_pvt *p, struct sip_request *req, int sipmethod, char *uri, enum xmittype reliable, struct sockaddr_in *sin, int ignore)
 {
 	return check_user_full(p, req, sipmethod, uri, reliable, sin, ignore, NULL);
 }
@@ -9653,6 +9669,8 @@
 {
 	char tmp[256];
 	char *s, *e;
+	char *domain;
+
 	ast_copy_string(tmp, get_header(req, "Contact"), sizeof(tmp));
 	s = get_in_brackets(tmp);
 	e = strchr(s, ';');
@@ -9669,16 +9687,25 @@
 			ast_string_field_build(p->owner, call_forward, "SIP/%s", s);
 	} else {
 		e = strchr(tmp, '@');
-		if (e)
+		if (e) {
 			*e = '\0';
+			e++;
+			domain = e;
+		} else {
+			/* No username part */
+			domain = tmp;
+		}
 		e = strchr(tmp, '/');
 		if (e)
 			*e = '\0';
 		if (!strncasecmp(s, "sip:", 4))
 			s += 4;
-		ast_log(LOG_DEBUG, "Found 302 Redirect to extension '%s'\n", s);
-		if (p->owner)
+		if (option_debug > 1)
+			ast_log(LOG_DEBUG, "Received 302 Redirect to extension '%s' (domain %s)\n", s, domain);
+		if (p->owner) {
+			pbx_builtin_setvar_helper(p->owner, "SIPDOMAIN", domain);
 			ast_string_field_set(p->owner, call_forward, s);
+		}
 	}
 }
 
@@ -9687,7 +9714,7 @@
 {
 	/* Go ahead and send bye at this point */
 	if (ast_test_flag(p, SIP_PENDINGBYE)) {
-		transmit_request_with_auth(p, SIP_BYE, 0, 1, 1);
+		transmit_request_with_auth(p, SIP_BYE, 0, XMIT_RELIABLE, 1);
 		ast_set_flag(p, SIP_NEEDDESTROY);	
 		ast_clear_flag(p, SIP_NEEDREINVITE);	
 	} else if (ast_test_flag(p, SIP_NEEDREINVITE)) {
@@ -9737,12 +9764,13 @@
 		break;
 	case 183:	/* Session progress */
 		sip_cancel_destroy(p);
+		/* Ignore 183 Session progress without SDP */
 		if (!strcasecmp(get_header(req, "Content-Type"), "application/sdp")) {
 			process_sdp(p, req);
-		}
-		if (!ignore && p->owner) {
-			/* Queue a progress frame */
-			ast_queue_control(p->owner, AST_CONTROL_PROGRESS);
+			if (!ignore && p->owner) {
+				/* Queue a progress frame */
+				ast_queue_control(p->owner, AST_CONTROL_PROGRESS);
+			}
 		}
 		break;
 	case 200:	/* 200 OK on invite - someone's answering our call */
@@ -9779,13 +9807,13 @@
 				ast_set_flag(p, SIP_PENDINGBYE);	
 		}
 		/* If I understand this right, the branch is different for a non-200 ACK only */
-		transmit_request(p, SIP_ACK, seqno, 0, 1);
+		transmit_request(p, SIP_ACK, seqno, XMIT_UNRELIABLE, 1);
 		check_pendings(p);
 		break;
 	case 407: /* Proxy authentication */
 	case 401: /* Www auth */
 		/* First we ACK */
-		transmit_request(p, SIP_ACK, seqno, 0, 0);
+		transmit_request(p, SIP_ACK, seqno, XMIT_UNRELIABLE, 0);
 		if (p->options)
 			p->options->auth_type = (resp == 401 ? WWW_AUTH : PROXY_AUTH);
 
@@ -9805,7 +9833,7 @@
 		break;
 	case 403: /* Forbidden */
 		/* First we ACK */
-		transmit_request(p, SIP_ACK, seqno, 0, 0);
+		transmit_request(p, SIP_ACK, seqno, XMIT_UNRELIABLE, 0);
 		ast_log(LOG_WARNING, "Forbidden - wrong password on authentication for INVITE to '%s'\n", get_header(&p->initreq, "From"));
 		if (!ignore && p->owner)
 			ast_queue_control(p->owner, AST_CONTROL_CONGESTION);
@@ -9813,7 +9841,7 @@
 		ast_set_flag(p, SIP_ALREADYGONE);	
 		break;
 	case 404: /* Not found */
-		transmit_request(p, SIP_ACK, seqno, 0, 0);
+		transmit_request(p, SIP_ACK, seqno, XMIT_UNRELIABLE, 0);
 		if (p->owner && !ignore)
 			ast_queue_control(p->owner, AST_CONTROL_CONGESTION);
 		ast_set_flag(p, SIP_ALREADYGONE);	
@@ -9821,7 +9849,7 @@
 	case 481: /* Call leg does not exist */
 		/* Could be REFER or INVITE */
 		ast_log(LOG_WARNING, "Re-invite to non-existing call leg on other UA. SIP dialog '%s'. Giving up.\n", p->callid);
-		transmit_request(p, SIP_ACK, seqno, 0, 0);
+		transmit_request(p, SIP_ACK, seqno, XMIT_UNRELIABLE, 0);
 		break;
 	case 491: /* Pending */
 		/* we have to wait a while, then retransmit */
@@ -9995,7 +10023,7 @@
 		if (peer->pokeexpire > -1)
 			ast_sched_del(sched, peer->pokeexpire);
 		if (sipmethod == SIP_INVITE)	/* Does this really happen? */
-			transmit_request(p, SIP_ACK, seqno, 0, 0);
+			transmit_request(p, SIP_ACK, seqno, XMIT_UNRELIABLE, 0);
 		ast_set_flag(p, SIP_NEEDDESTROY);	
 
 		/* Try again eventually */
@@ -10145,6 +10173,7 @@
 			break;
 		default:
 			if ((resp >= 300) && (resp < 700)) {
+				/* Fatal response */
 				if ((option_verbose > 2) && (resp != 487))
 					ast_verbose(VERBOSE_PREFIX_3 "Got SIP response %d \"%s\" back from %s\n", resp, rest, ast_inet_ntoa(iabuf, sizeof(iabuf), p->sa.sin_addr));
 				ast_set_flag(p, SIP_ALREADYGONE);	
@@ -10170,7 +10199,7 @@
 					if (p->owner)
 						ast_queue_control(p->owner, AST_CONTROL_BUSY);
 					break;
-				case 487:
+				case 487:	/* Response on INVITE that has been CANCELled */
 					/* channel now destroyed - dec the inUse counter */
 					update_call_counter(p, DEC_CALL_LIMIT);
 					break;
@@ -10201,7 +10230,7 @@
 				}
 				/* ACK on invite */
 				if (sipmethod == SIP_INVITE) 
-					transmit_request(p, SIP_ACK, seqno, 0, 0);
+					transmit_request(p, SIP_ACK, seqno, XMIT_UNRELIABLE, 0);
 				ast_set_flag(p, SIP_ALREADYGONE);	
 				if (!p->owner)
 					ast_set_flag(p, SIP_NEEDDESTROY);	
@@ -10569,12 +10598,12 @@
 	if (!p->lastinvite && !ignore && !p->owner) {
 
 		/* Handle authentication if this is our first invite */
-		res = check_user(p, req, SIP_INVITE, e, 1, sin, ignore);
+		res = check_user(p, req, SIP_INVITE, e, XMIT_RELIABLE, sin, ignore);
 		if (res > 0)	/* We have challenged the user for auth */
 			return 0; 
 		if (res < 0) { /* Something failed in authentication */
 			ast_log(LOG_NOTICE, "Failed to authenticate user %s\n", get_header(req, "From"));
-			transmit_response_reliable(p, "403 Forbidden", req, 1);
+			transmit_response_reliable(p, "403 Forbidden", req);
 			ast_set_flag(p, SIP_NEEDDESTROY);
 			ast_string_field_free(p, theirtag);
 			return 0;
@@ -10584,7 +10613,7 @@
 		if (!ast_strlen_zero(get_header(req, "Content-Type"))) {
 			if (process_sdp(p, req)) {
 				/* Unacceptable codecs */
-				transmit_response_reliable(p, "488 Not acceptable here", req, 1);
+				transmit_response_reliable(p, "488 Not acceptable here", req);
 				ast_set_flag(p, SIP_NEEDDESTROY);	
 				return -1;
 			}
@@ -10609,7 +10638,7 @@
 		if (res) {
 			if (res < 0) {
 				ast_log(LOG_NOTICE, "Failed to place call for user %s, too many calls\n", p->username);
-				transmit_response_reliable(p, "480 Temporarily Unavailable (Call limit) ", req, 1);
+				transmit_response_reliable(p, "480 Temporarily Unavailable (Call limit) ", req);
 				ast_set_flag(p, SIP_NEEDDESTROY);	
 			}
 			return 0;
@@ -10621,10 +10650,10 @@
 
 		if (gotdest) {
 			if (gotdest < 0) {
-				transmit_response_reliable(p, "404 Not Found", req, 1);
+				transmit_response_reliable(p, "404 Not Found", req);
 				update_call_counter(p, DEC_CALL_LIMIT);
 			} else {
-				transmit_response_reliable(p, "484 Address Incomplete", req, 1);
+				transmit_response_reliable(p, "484 Address Incomplete", req);
 				update_call_counter(p, DEC_CALL_LIMIT);
 			}
 			ast_set_flag(p, SIP_NEEDDESTROY);		
@@ -10675,14 +10704,14 @@
 					if (ignore)
 						transmit_response(p, "503 Unavailable", req);
 					else
-						transmit_response_reliable(p, "503 Unavailable", req, 1);
+						transmit_response_reliable(p, "503 Unavailable", req);
 					break;
 				case AST_PBX_CALL_LIMIT:
 					ast_log(LOG_WARNING, "Failed to start PBX (call limit reached) \n");
 					if (ignore)
 						transmit_response(p, "480 Temporarily Unavailable", req);
 					else
-						transmit_response_reliable(p, "480 Temporarily Unavailable", req, 1);
+						transmit_response_reliable(p, "480 Temporarily Unavailable", req);
 					break;
 				case AST_PBX_SUCCESS:
 					/* nothing to do */
@@ -10705,7 +10734,7 @@
 					if (ignore)
 						transmit_response(p, "503 Unavailable", req);
 					else
-						transmit_response_reliable(p, "503 Unavailable", req, 1);
+						transmit_response_reliable(p, "503 Unavailable", req);
 					ast_set_flag(p, SIP_ALREADYGONE);	
 					/* Unlock locks so ast_hangup can do its magic */
 					ast_mutex_unlock(&p->lock);
@@ -10740,14 +10769,14 @@
 				if (ignore)
 					transmit_response(p, "488 Not Acceptable Here (codec error)", req);
 				else
-					transmit_response_reliable(p, "488 Not Acceptable Here (codec error)", req, 1);
+					transmit_response_reliable(p, "488 Not Acceptable Here (codec error)", req);
 				ast_set_flag(p, SIP_NEEDDESTROY);	
 			} else {
 				ast_log(LOG_NOTICE, "Unable to create/find channel\n");
 				if (ignore)
 					transmit_response(p, "503 Unavailable", req);
 				else
-					transmit_response_reliable(p, "503 Unavailable", req, 1);
+					transmit_response_reliable(p, "503 Unavailable", req);
 				ast_set_flag(p, SIP_NEEDDESTROY);	
 			}
 		}
@@ -10815,7 +10844,7 @@
 			transmit_notify_with_sipfrag(p, seqno);
 			/* Always increment on a BYE */
 			if (!nobye) {
-				transmit_request_with_auth(p, SIP_BYE, 0, 1, 1);
+				transmit_request_with_auth(p, SIP_BYE, 0, XMIT_RELIABLE, 1);
 				ast_set_flag(p, SIP_ALREADYGONE);	
 			}
 		}
@@ -10842,7 +10871,7 @@
 		ast_set_flag(p, SIP_NEEDDESTROY);	
 	if (p->initreq.len > 0) {
 		if (!ignore)
-			transmit_response_reliable(p, "487 Request Terminated", &p->initreq, 1);
+			transmit_response_reliable(p, "487 Request Terminated", &p->initreq);
 		transmit_response(p, "200 OK", req);
 		return 1;
 	} else {
@@ -10860,7 +10889,7 @@
 	char iabuf[INET_ADDRSTRLEN];
 	
 	if (p->pendinginvite && !ast_test_flag(p, SIP_OUTGOING) && !ignore)
-		transmit_response_reliable(p, "487 Request Terminated", &p->initreq, 1);
+		transmit_response_reliable(p, "487 Request Terminated", &p->initreq);
 
 	copy_request(&p->initreq, req);
 	check_via(p, req);
@@ -10965,7 +10994,6 @@
 		}
 		return 0;
 	}
-
 	/* Initialize the context if it hasn't been already */
 	if (!ast_strlen_zero(p->subscribecontext))
 		ast_string_field_set(p, context, p->subscribecontext);
@@ -11261,7 +11289,7 @@
 		if (!p->initreq.headers && ast_test_flag(req, SIP_PKT_WITH_TOTAG)) {
 			/* If this is a first request and it got a to-tag, it is not for us */
 			if (!ignore && req->method == SIP_INVITE) {
-				transmit_response_reliable(p, "481 Call/Transaction Does Not Exist", req, 1);
+				transmit_response_reliable(p, "481 Call/Transaction Does Not Exist", req);
 				/* Will cease to exist after ACK */
 			} else {
 				transmit_response(p, "481 Call/Transaction Does Not Exist", req);
@@ -13244,7 +13272,7 @@
 	}
 
 	ast_string_field_build(p, our_contact, "Transfer <sip:%s@%s%s%s>", extension, host, port ? ":" : "", port ? port : "");
-	transmit_response_reliable(p, "302 Moved Temporarily", &p->initreq, 1);
+	transmit_response_reliable(p, "302 Moved Temporarily", &p->initreq);
 
 	/* this is all that we want to send to that SIP device */
 	ast_set_flag(p, SIP_ALREADYGONE);

Modified: team/oej/test-this-branch/channels/misdn/chan_misdn_config.h
URL: http://svn.digium.com/view/asterisk/team/oej/test-this-branch/channels/misdn/chan_misdn_config.h?rev=12571&r1=12570&r2=12571&view=diff
==============================================================================
--- team/oej/test-this-branch/channels/misdn/chan_misdn_config.h (original)
+++ team/oej/test-this-branch/channels/misdn/chan_misdn_config.h Sun Mar 12 11:23:11 2006
@@ -34,6 +34,7 @@
 	MISDN_CFG_METHOD,              /* char[] */
 	MISDN_CFG_DIALPLAN,            /* int */
 	MISDN_CFG_LOCALDIALPLAN,       /* int */
+	MISDN_CFG_CPNDIALPLAN,       /* int */
 	MISDN_CFG_NATPREFIX,           /* char[] */
 	MISDN_CFG_INTERNATPREFIX,      /* char[] */
 	MISDN_CFG_PRES,                /* int */

Modified: team/oej/test-this-branch/channels/misdn/isdn_lib.c
URL: http://svn.digium.com/view/asterisk/team/oej/test-this-branch/channels/misdn/isdn_lib.c?rev=12571&r1=12570&r2=12571&view=diff
==============================================================================
--- team/oej/test-this-branch/channels/misdn/isdn_lib.c (original)
+++ team/oej/test-this-branch/channels/misdn/isdn_lib.c Sun Mar 12 11:23:11 2006
@@ -463,6 +463,7 @@
 	bc->dnumplan=NUMPLAN_UNKNOWN;
 	bc->onumplan=NUMPLAN_UNKNOWN;
 	bc->rnumplan=NUMPLAN_UNKNOWN;
+	bc->cpnnumplan=NUMPLAN_UNKNOWN;
 	
 
 	bc->active = 0;

Modified: team/oej/test-this-branch/channels/misdn/isdn_lib.h
URL: http://svn.digium.com/view/asterisk/team/oej/test-this-branch/channels/misdn/isdn_lib.h?rev=12571&r1=12570&r2=12571&view=diff
==============================================================================
--- team/oej/test-this-branch/channels/misdn/isdn_lib.h (original)
+++ team/oej/test-this-branch/channels/misdn/isdn_lib.h Sun Mar 12 11:23:11 2006
@@ -210,6 +210,7 @@
 	enum mISDN_NUMBER_PLAN dnumplan;
 	enum mISDN_NUMBER_PLAN rnumplan;
 	enum mISDN_NUMBER_PLAN onumplan;
+	enum mISDN_NUMBER_PLAN cpnnumplan;
 
 	int progress_coding;
 	int progress_location;

Modified: team/oej/test-this-branch/channels/misdn/isdn_msg_parser.c
URL: http://svn.digium.com/view/asterisk/team/oej/test-this-branch/channels/misdn/isdn_msg_parser.c?rev=12571&r1=12570&r2=12571&view=diff
==============================================================================
--- team/oej/test-this-branch/channels/misdn/isdn_msg_parser.c (original)
+++ team/oej/test-this-branch/channels/misdn/isdn_msg_parser.c Sun Mar 12 11:23:11 2006
@@ -359,7 +359,7 @@
 	}
   
 	{
-		int type=0, plan=1, present=2, screen=0;
+		int type=bc->cpnnumplan, plan=1, present=2, screen=0;
 		enc_ie_connected_pn(&connect->CONNECT_PN, msg, type,plan, present, screen, (unsigned char*) bc->dad , nt , bc);
 	}
 

Modified: team/oej/test-this-branch/channels/misdn_config.c
URL: http://svn.digium.com/view/asterisk/team/oej/test-this-branch/channels/misdn_config.c?rev=12571&r1=12570&r2=12571&view=diff
==============================================================================
--- team/oej/test-this-branch/channels/misdn_config.c (original)
+++ team/oej/test-this-branch/channels/misdn_config.c Sun Mar 12 11:23:11 2006
@@ -95,6 +95,7 @@
 	{ "method", MISDN_CFG_METHOD, MISDN_CTYPE_STR, "standard", NONE },
 	{ "dialplan", MISDN_CFG_DIALPLAN, MISDN_CTYPE_INT, "0", NONE },
 	{ "localdialplan", MISDN_CFG_LOCALDIALPLAN, MISDN_CTYPE_INT, "0", NONE },
+	{ "cpndialplan", MISDN_CFG_CPNDIALPLAN, MISDN_CTYPE_INT, "0", NONE },
 	{ "nationalprefix", MISDN_CFG_NATPREFIX, MISDN_CTYPE_STR, "0", NONE },
 	{ "internationalprefix", MISDN_CFG_INTERNATPREFIX, MISDN_CTYPE_STR, "00", NONE },
 	{ "presentation", MISDN_CFG_PRES, MISDN_CTYPE_INT, "-1", NONE },

Modified: team/oej/test-this-branch/configs/cdr_tds.conf.sample

[... 476 lines stripped ...]


More information about the asterisk-commits mailing list