[asterisk-commits] oej: branch oej/codename-pineapple r48284 - in /team/oej/codename-pineapple: ...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Tue Dec 5 14:40:59 MST 2006


Author: oej
Date: Tue Dec  5 15:40:59 2006
New Revision: 48284

URL: http://svn.digium.com/view/asterisk?view=rev&rev=48284
Log:
- stringfieldify devices (still compiles with errors)

- added globals to domains (just a start, need to figure out configuration syntax)


Modified:
    team/oej/codename-pineapple/channels/chan_sip3.c
    team/oej/codename-pineapple/channels/sip3/sip3.h
    team/oej/codename-pineapple/channels/sip3/sip3_compose.c
    team/oej/codename-pineapple/channels/sip3/sip3_config.c
    team/oej/codename-pineapple/channels/sip3/sip3_services.c
    team/oej/codename-pineapple/configs/sip3.conf.sample

Modified: team/oej/codename-pineapple/channels/chan_sip3.c
URL: http://svn.digium.com/view/asterisk/team/oej/codename-pineapple/channels/chan_sip3.c?view=diff&rev=48284&r1=48283&r2=48284
==============================================================================
--- team/oej/codename-pineapple/channels/chan_sip3.c (original)
+++ team/oej/codename-pineapple/channels/chan_sip3.c Tue Dec  5 15:40:59 2006
@@ -417,7 +417,7 @@
 
 /* Default setttings are used as a channel setting and as a default when
    configuring devices */
-/* Global settings only apply to the channel */
+/*! Global settings only apply to the channel */
 struct sip_globals global;
 
 /* Object counters */
@@ -835,6 +835,9 @@
 		device->registry->peer = NULL;
 		ASTOBJ_UNREF(device->registry,sip_registry_destroy);
 	}
+
+	/* Free the stringfield pool */
+	ast_string_field_free_pools(device);
 	free(device);
 }
 
@@ -2682,7 +2685,8 @@
 		return;
 
 	if (username)
-		ast_copy_string(peer->defaultuser, username, sizeof(peer->defaultuser));
+		ast_string_field_set(peer, defaultuser, username);
+		//ast_copy_string(peer->defaultuser, username, sizeof(peer->defaultuser));
 	if (contact)
 		ast_copy_string(peer->fullcontact, contact, sizeof(peer->fullcontact));
 
@@ -2904,9 +2908,11 @@
 	peer->sipoptions = pvt->sipoptions;
 
 	if (curi) {	/* Overwrite the default username from config at registration */
-		ast_copy_string(peer->defaultuser, curi, sizeof(peer->defaultuser));
+		ast_string_field_set(peer, defaultuser, curi);
+		//ast_copy_string(peer->defaultuser, curi, sizeof(peer->defaultuser));
 	} else
-		peer->defaultuser[0] = '\0';
+		ast_string_field_set(peer, defaultuser, "");
+		//peer->defaultuser[0] = '\0';
 
 	if (peer->expire > -1)
 		ast_sched_del(sched, peer->expire);
@@ -6361,7 +6367,7 @@
 	}
 	/* Send MWI */
 	ast_set_flag(&p->flags[0], SIP_OUTGOING);
-	transmit_notify_with_mwi(p, newmsgs, oldmsgs, peer->vmexten);
+	transmit_notify_with_mwi(p, newmsgs, oldmsgs, (char *) peer->vmexten);
 	return 0;
 }
 

Modified: team/oej/codename-pineapple/channels/sip3/sip3.h
URL: http://svn.digium.com/view/asterisk/team/oej/codename-pineapple/channels/sip3/sip3.h?view=diff&rev=48284&r1=48283&r2=48284
==============================================================================
--- team/oej/codename-pineapple/channels/sip3/sip3.h (original)
+++ team/oej/codename-pineapple/channels/sip3/sip3.h Tue Dec  5 15:40:59 2006
@@ -45,8 +45,8 @@
 #endif
 
 #define DEFAULT_DEFAULT_EXPIRY  120
-#define DEFAULT_MIN_EXPIRY      60
-#define DEFAULT_MAX_EXPIRY      3600
+#define DEFAULT_MIN_EXPIRY      60		/*! Minimum expiry time for subscription and registration requests */
+#define DEFAULT_MAX_EXPIRY      3600		/*! Maximum expiry time for regs and subs */
 #define DEFAULT_REGISTRATION_TIMEOUT 20
 #define DEFAULT_MAX_FORWARDS    "70"
 
@@ -497,6 +497,62 @@
 	char hop[0];
 };
 
+/*! Global settings only apply to the channel */
+struct sip_globals {
+	struct ast_jb_conf jbconf;	/*!< Jitterbuffer configuration */
+	int maxforwards;		/*!< Max forwards */
+	int rtautoclear;		/*!< Realtime caching options */
+	int notifyringing;		/*!< Send notifications on ringing */
+	int alwaysauthreject;		/*!< Send 401 Unauthorized for all failing requests */
+	int srvlookup;			/*!< SRV Lookup on or off. Default is off, RFC behavior is on */
+	int autocreatepeer;		/*!< Auto creation of peers at registration? Default off. */
+	int relaxdtmf;			/*!< Relax DTMF */
+	int rtptimeout;			/*!< Time out call if no RTP */
+	int rtpholdtimeout;
+	int rtpkeepalive;		/*!< Send RTP keepalives */
+	int reg_timeout;	
+	int regattempts_max;		/*!< Registration attempts before giving up */
+	int allowguest;			/*!< allow unauthenticated users/peers to connect? */
+	int allowsubscribe;		/*!< Flag for disabling ALL subscriptions, this is FALSE only if all peers are FALSE 
+					    	the global setting is in globals_flags[1] */
+	int mwitime;			/*!< Time between MWI checks for peers */
+	unsigned int tos_sip;		/*!< IP type of service for SIP packets */
+	unsigned int tos_audio;		/*!< IP type of service for audio RTP packets */
+	unsigned int tos_video;		/*!< IP type of service for video RTP packets */
+	unsigned int tos_presence;	/*!< IP type of service for SIP presence packets */
+	int compactheaders;		/*!< send compact sip headers */
+	int recordhistory;		/*!< Record SIP history. Off by default */
+	int dumphistory;		/*!< Dump history to verbose before destroying SIP dialog */
+	char realm[MAXHOSTNAMELEN]; 	/*!< Default realm */
+	char regcontext[AST_MAX_CONTEXT];	/*!< Context for auto-extensions */
+	char useragent[AST_MAX_EXTENSION];	/*!< Useragent for the SIP channel */
+	int allow_external_domains;	/*!< Accept calls to external SIP domains? */
+	int callevents;			/*!< Whether we send manager events or not */
+	int t1min;			/*!< T1 roundtrip time minimum */
+	enum transfermodes allowtransfer;	/*!< SIP Refer restriction scheme */
+	int autoframing;
+	struct ast_flags flags[2];	/* Flags for various default settings */
+	/* Default values */
+	int default_qualifycheck_ok;	/*!< Default qualify time when status is ok */
+	int default_qualifycheck_notok;	/*!< Default qualify time when statusis not ok */
+	int default_qualify;		/*!< Default Qualify= setting */
+	int capability;			/*!< Codec support */
+	int dtmf_capability;		/*!< DTMF support (2833) */
+	int t38_capability;		/*!< T38 Capability */
+	char default_context[AST_MAX_CONTEXT];
+	char default_subscribecontext[AST_MAX_CONTEXT];
+	char default_language[MAX_LANGUAGE];
+	char default_callerid[AST_MAX_EXTENSION];
+	char default_fromdomain[AST_MAX_EXTENSION];
+	char default_notifymime[AST_MAX_EXTENSION];
+	char default_vmexten[AST_MAX_EXTENSION];
+	char default_mohinterpret[MAX_MUSICCLASS];  /*!< Global setting for moh class to use when put on hold */
+	char default_mohsuggest[MAX_MUSICCLASS];	   /*!< Global setting for moh class to suggest when putting 
+                                                    *   a bridged channel on hold */
+	int default_maxcallbitrate;	/*!< Maximum bitrate for call */
+	struct ast_codec_pref default_prefs;	/*!< Default codec prefs */
+};
+
 
 /*! \brief Domain data structure. 
 	\note In the future, we will connect this to a configuration tree specific
@@ -506,6 +562,7 @@
 	char domain[MAXHOSTNAMELEN];		/*!< SIP domain we are responsible for */
 	char context[AST_MAX_EXTENSION];	/*!< Incoming context for this domain */
 	enum domain_mode mode;			/*!< How did we find this domain? */
+	struct sip_globals globals;		/*!< Globals for this domain */
 	AST_LIST_ENTRY(domain) list;		/*!< List mechanics */
 };
 
@@ -771,6 +828,7 @@
 	int expiry;				/*!< How long we take to expire */
 	char tag[11];				/*!< Dialog ID: Our tag for this session */
 	int callingpres;			/*!< Caller ID presentation settings */
+	int maxforwards;			/*!< Max forwards for this dialog */
 	struct sip_route *route;		/*!< Head of linked list of routing steps (fm Record-Route) */
 	int route_persistant;			/*!< Is this the "real" route? */
 	char lastmsg[256];			/*!< Last Message sent/received */
@@ -860,34 +918,50 @@
 						a domain only 
 					For type=phone, the domain needs to be a locally hosted domain */
 	enum objecttype type;		/*!< SIP_PEER */
-	char secret[80];		/*!< Password */
-	char md5secret[80];		/*!< Password in MD5 */
+	AST_DECLARE_STRING_FIELDS(
+		AST_STRING_FIELD(secret);	/*!< Secret (password) */
+		AST_STRING_FIELD(md5secret);	/*!< Secret (password in md5 digest with realm and username) */
+		AST_STRING_FIELD(context);	/*!< Default context for incoming calls */
+		AST_STRING_FIELD(subscribecontext);	/*!< Default context for subscriptions */
+		AST_STRING_FIELD(defaultuser);	/*!< Temporary username until registration */ 
+		AST_STRING_FIELD(authuser);	/*!< Authentication user name */
+		AST_STRING_FIELD(regexten); 	/*!< Extension to register (if regcontext is used) */
+		AST_STRING_FIELD(fromuser);	/*!< From: user when calling this peer */
+		AST_STRING_FIELD(fromdomain);	/*!< From: domain when calling this peer */
+		AST_STRING_FIELD(vmexten); 	/*!< Dialplan extension for MWI notify message*/
+		AST_STRING_FIELD(mailbox); 	/*!< Mailbox setting for MWI checks */
+	);
+	//char secret[80];		/*!< Password */
+	//char md5secret[80];		/*!< Password in MD5 */
 	struct sip_auth *auth;		/*!< Realm authentication list */
-	char context[AST_MAX_CONTEXT];	/*!< Default context for incoming calls */
-	char subscribecontext[AST_MAX_CONTEXT];	/*!< Default context for subscriptions */
-	char defaultuser[80];		/*!< Temporary username until registration */ 
-	char authuser[80];		/*!< Authentication user name */
+	//char context[AST_MAX_CONTEXT];	/*!< Default context for incoming calls */
+	//char subscribecontext[AST_MAX_CONTEXT];	/*!< Default context for subscriptions */
+	//char defaultuser[80];		/*!< Temporary username until registration */ 
+	//char authuser[80];		/*!< Authentication user name */
 	char accountcode[AST_MAX_ACCOUNT_CODE];	/*!< Account code */
 	int amaflags;			/*!< AMA Flags (for billing) */
 	char tohost[MAXHOSTNAMELEN];	/*!< If not dynamic, IP address */
-	char regexten[AST_MAX_EXTENSION]; /*!< Extension to register (if regcontext is used) */
-	char fromuser[80];		/*!< From: user when calling this peer */
-	char fromdomain[MAXHOSTNAMELEN];	/*!< From: domain when calling this peer */
-	char fullcontact[256];		/*!< Contact registered with us (not in sip.conf) */
+	//char regexten[AST_MAX_EXTENSION]; /*!< Extension to register (if regcontext is used) */
+	//char fromuser[80];		/*!< From: user when calling this peer */
+	//char fromdomain[MAXHOSTNAMELEN];	/*!< From: domain when calling this peer */
+	char fullcontact[256];		/*!< Contact registered with us (not in sip.conf)
+					 *  \note XXX Needs to move to stringfields!!! */
 	char cid_num[80];		/*!< Caller ID num */
 	char cid_name[80];		/*!< Caller ID name */
 	int callingpres;		/*!< Calling id presentation */
 	int inUse;			/*!< Number of calls in use */
 	int inRinging;			/*!< Number of calls ringing */
+	int maxforwards;		/*!< Max forwards */
 	int onHold;                     /*!< Peer has someone on hold */
 	int call_limit;			/*!< Limit of concurrent calls */
 	enum transfermodes allowtransfer;	/*! SIP Refer restriction scheme */
-	char vmexten[AST_MAX_EXTENSION]; /*!< Dialplan extension for MWI notify message*/
-	char mailbox[AST_MAX_EXTENSION]; /*!< Mailbox setting for MWI checks */
+	//char vmexten[AST_MAX_EXTENSION]; /*!< Dialplan extension for MWI notify message*/
+	//char mailbox[AST_MAX_EXTENSION]; /*!< Mailbox setting for MWI checks */
 	char language[MAX_LANGUAGE];	/*!<  Default language for prompts */
 	char mohinterpret[MAX_MUSICCLASS];/*!<  Music on Hold class */
 	char mohsuggest[MAX_MUSICCLASS];/*!<  Music on Hold class */
-	char useragent[256];		/*!<  User agent in SIP request (saved from registration) */
+	char useragent[256];		/*!<  User agent in SIP request (saved from registration) 
+					 *! \note XXX Needs to move to stringfields!!! */
 	struct ast_codec_pref prefs;	/*!<  codec prefs */
 	int lastmsgssent;
 	time_t	lastmsgcheck;		/*!<  Last time we checked for MWI */
@@ -957,60 +1031,6 @@
 	struct sip_peer *peer;		/*!< If we have a known peer for this registry entry, use it for incoming calls */
 };
 
-/* Global settings only apply to the channel */
-struct sip_globals {
-	struct ast_jb_conf jbconf;	/*!< Jitterbuffer configuration */
-	int rtautoclear;		/*!< Realtime caching options */
-	int notifyringing;		/*!< Send notifications on ringing */
-	int alwaysauthreject;		/*!< Send 401 Unauthorized for all failing requests */
-	int srvlookup;			/*!< SRV Lookup on or off. Default is off, RFC behavior is on */
-	int autocreatepeer;		/*!< Auto creation of peers at registration? Default off. */
-	int relaxdtmf;			/*!< Relax DTMF */
-	int rtptimeout;			/*!< Time out call if no RTP */
-	int rtpholdtimeout;
-	int rtpkeepalive;		/*!< Send RTP keepalives */
-	int reg_timeout;	
-	int regattempts_max;		/*!< Registration attempts before giving up */
-	int allowguest;			/*!< allow unauthenticated users/peers to connect? */
-	int allowsubscribe;		/*!< Flag for disabling ALL subscriptions, this is FALSE only if all peers are FALSE 
-					    	the global setting is in globals_flags[1] */
-	int mwitime;			/*!< Time between MWI checks for peers */
-	unsigned int tos_sip;		/*!< IP type of service for SIP packets */
-	unsigned int tos_audio;		/*!< IP type of service for audio RTP packets */
-	unsigned int tos_video;		/*!< IP type of service for video RTP packets */
-	unsigned int tos_presence;	/*!< IP type of service for SIP presence packets */
-	int compactheaders;		/*!< send compact sip headers */
-	int recordhistory;		/*!< Record SIP history. Off by default */
-	int dumphistory;		/*!< Dump history to verbose before destroying SIP dialog */
-	char realm[MAXHOSTNAMELEN]; 	/*!< Default realm */
-	char regcontext[AST_MAX_CONTEXT];	/*!< Context for auto-extensions */
-	char useragent[AST_MAX_EXTENSION];	/*!< Useragent for the SIP channel */
-	int allow_external_domains;	/*!< Accept calls to external SIP domains? */
-	int callevents;			/*!< Whether we send manager events or not */
-	int t1min;			/*!< T1 roundtrip time minimum */
-	enum transfermodes allowtransfer;	/*!< SIP Refer restriction scheme */
-	int autoframing;
-	struct ast_flags flags[2];	/* Flags for various default settings */
-	/* Default values */
-	int default_qualifycheck_ok;	/*!< Default qualify time when status is ok */
-	int default_qualifycheck_notok;	/*!< Default qualify time when statusis not ok */
-	int default_qualify;		/*!< Default Qualify= setting */
-	int capability;			/*!< Codec support */
-	int dtmf_capability;		/*!< DTMF support (2833) */
-	int t38_capability;		/*!< T38 Capability */
-	char default_context[AST_MAX_CONTEXT];
-	char default_subscribecontext[AST_MAX_CONTEXT];
-	char default_language[MAX_LANGUAGE];
-	char default_callerid[AST_MAX_EXTENSION];
-	char default_fromdomain[AST_MAX_EXTENSION];
-	char default_notifymime[AST_MAX_EXTENSION];
-	char default_vmexten[AST_MAX_EXTENSION];
-	char default_mohinterpret[MAX_MUSICCLASS];  /*!< Global setting for moh class to use when put on hold */
-	char default_mohsuggest[MAX_MUSICCLASS];	   /*!< Global setting for moh class to suggest when putting 
-                                                    *   a bridged channel on hold */
-	int default_maxcallbitrate;	/*!< Maximum bitrate for call */
-	struct ast_codec_pref default_prefs;	/*!< Default codec prefs */
-};
 
 /* Network interface settings */
 struct sip_network {

Modified: team/oej/codename-pineapple/channels/sip3/sip3_compose.c
URL: http://svn.digium.com/view/asterisk/team/oej/codename-pineapple/channels/sip3/sip3_compose.c?view=diff&rev=48284&r1=48283&r2=48284
==============================================================================
--- team/oej/codename-pineapple/channels/sip3/sip3_compose.c (original)
+++ team/oej/codename-pineapple/channels/sip3/sip3_compose.c Tue Dec  5 15:40:59 2006
@@ -507,7 +507,7 @@
 	snprintf(tmp, sizeof(tmp), "%d %s", ++p->ocseq, sip_method2txt(sipmethod));
 
 	add_header(req, "Via", p->via);
-	add_header(req, "Max-Forwards", DEFAULT_MAX_FORWARDS);
+	add_header(req, "Max-Forwards", global.maxforwards);
 	/* SLD: FIXME?: do Route: here too?  I think not cos this is the first request.
 	 * OTOH, then we won't have anything in p->route anyway */
 	/* Build Remote Party-ID and From */
@@ -587,7 +587,7 @@
 		set_destination(p, p->route->hop);
 		add_route(req, is_strict ? p->route->next : p->route);
 	}
-	add_header(req, "Max-Forwards", DEFAULT_MAX_FORWARDS);
+	add_header(req, "Max-Forwards", global.maxforwards);
 
 	ot = get_header(orig, "To");
 	of = get_header(orig, "From");

Modified: team/oej/codename-pineapple/channels/sip3/sip3_config.c
URL: http://svn.digium.com/view/asterisk/team/oej/codename-pineapple/channels/sip3/sip3_config.c?view=diff&rev=48284&r1=48283&r2=48284
==============================================================================
--- team/oej/codename-pineapple/channels/sip3/sip3_config.c (original)
+++ team/oej/codename-pineapple/channels/sip3/sip3_config.c Tue Dec  5 15:40:59 2006
@@ -279,8 +279,10 @@
 	}
 	ast_copy_flags(&device->flags[0], &global.flags[0], SIP_FLAGS_TO_COPY);
 	ast_copy_flags(&device->flags[1], &global.flags[1], SIP_PAGE2_FLAGS_TO_COPY);
-	strcpy(device->context, global.default_context);
-	strcpy(device->subscribecontext, global.default_subscribecontext);
+	ast_string_field_set(device, context, global.default_context);
+	ast_string_field_set(device, subscribecontext, global.default_subscribecontext);
+	//strcpy(device->context, global.default_context);
+	//strcpy(device->subscribecontext, global.default_subscribecontext);
 	strcpy(device->language, global.default_language);
 	strcpy(device->mohinterpret, global.default_mohinterpret);
 	strcpy(device->mohsuggest, global.default_mohsuggest);
@@ -292,14 +294,20 @@
 	device->rtpkeepalive = global.rtpkeepalive;
 	device->maxcallbitrate = global.default_maxcallbitrate;
 	strcpy(device->vmexten, global.default_vmexten);
-	device->secret[0] = '\0';
-	device->md5secret[0] = '\0';
+	ast_string_field_set(device, secret, "");
+	ast_string_field_set(device, md5secret, "");
+	ast_string_field_set(device, fromdomain, "");
+	ast_string_field_set(device, fromuser, "");
+	ast_string_field_set(device, regexten, "");
+	ast_string_field_set(device, mailbox, "");
+	//device->fromdomain[0] = '\0';
+	//device->fromuser[0] = '\0';
+	//device->regexten[0] = '\0';
+	//device->mailbox[0] = '\0';
+	//device->secret[0] = '\0';
+	//device->md5secret[0] = '\0';
 	device->cid_num[0] = '\0';
 	device->cid_name[0] = '\0';
-	device->fromdomain[0] = '\0';
-	device->fromuser[0] = '\0';
-	device->regexten[0] = '\0';
-	device->mailbox[0] = '\0';
 	device->callgroup = 0;
 	device->pickupgroup = 0;
 	device->allowtransfer = global.allowtransfer;
@@ -337,6 +345,11 @@
  	} else {
 		if (!(device = ast_calloc(1, sizeof(*device))))
 			return NULL;
+
+		if (ast_string_field_init(device, 512)) {	/* Initialize string field buffer */
+			free(device);
+			return NULL;
+		}
 
 		if (realtime)
 			sipcounters.realtime_peers++;
@@ -378,11 +391,13 @@
 			ast_copy_string(device->fullcontact, v->value, sizeof(device->fullcontact));
 			ast_set_flag(&device->flags[1], SIP_PAGE2_RT_FROMCONTACT);
 		} else if (!strcasecmp(v->name, "secret")) 
-			ast_copy_string(device->secret, v->value, sizeof(device->secret));
+			ast_string_field_set(device, secret, v->value);
+			//ast_copy_string(device->secret, v->value, sizeof(device->secret));
 		else if (!strcasecmp(v->name, "authuser")) 
 			ast_copy_string(device->authuser, v->value, sizeof(device->authuser));
 		else if (!strcasecmp(v->name, "md5secret")) 
-			ast_copy_string(device->md5secret, v->value, sizeof(device->md5secret));
+			ast_string_field_set(device, md5secret, v->value);
+			//ast_copy_string(device->md5secret, v->value, sizeof(device->md5secret));
 		else if (!strcasecmp(v->name, "auth"))
 			device->auth = add_realm_authentication(device->auth, v->value, v->lineno);
 		else if (!strcasecmp(v->name, "callerid")) {
@@ -392,15 +407,19 @@
 		} else if (!strcasecmp(v->name, "cid_number")) {
 			ast_copy_string(device->cid_num, v->value, sizeof(device->cid_num));
 		} else if (!strcasecmp(v->name, "context")) {
-			ast_copy_string(device->context, v->value, sizeof(device->context));
+			ast_string_field_set(device, context, v->value);
+			//ast_copy_string(device->context, v->value, sizeof(device->context));
 		} else if (!strcasecmp(v->name, "subscribecontext")) {
-			ast_copy_string(device->subscribecontext, v->value, sizeof(device->subscribecontext));
-		} else if (!strcasecmp(v->name, "fromdomain")) {
-			ast_copy_string(device->fromdomain, v->value, sizeof(device->fromdomain));
+			ast_string_field_set(device, subscribecontext, v->value);
+			//ast_copy_string(device->subscribecontext, v->value, sizeof(device->subscribecontext));
 		} else if (!strcasecmp(v->name, "usereqphone")) {
 			ast_set2_flag(&device->flags[0], ast_true(v->value), SIP_USEREQPHONE);
+		} else if (!strcasecmp(v->name, "fromdomain")) {
+			ast_string_field_set(device, fromdomain, v->value);
+			//ast_copy_string(device->fromdomain, v->value, sizeof(device->fromdomain));
 		} else if (!strcasecmp(v->name, "fromuser")) {
-			ast_copy_string(device->fromuser, v->value, sizeof(device->fromuser));
+			ast_string_field_set(device, fromuser, v->value);
+			//ast_copy_string(device->fromuser, v->value, sizeof(device->fromuser));
 		} else if (!strcasecmp(v->name, "host") || !strcasecmp(v->name, "outboundproxy")) {
 			if (!strcasecmp(v->value, "dynamic")) {
 				if (!strcasecmp(v->name, "outboundproxy") || obproxyfound) {
@@ -456,11 +475,13 @@
 			if (device->callingpres == -1)
 				device->callingpres = atoi(v->value);
 		} else if (!strcasecmp(v->name, "defaultuser")) {
-			ast_copy_string(device->defaultuser, v->value, sizeof(device->defaultuser));
+			ast_string_field_set(device, subscribecontext, v->value);
+			//ast_copy_string(device->defaultuser, v->value, sizeof(device->defaultuser));
 		} else if (!strcasecmp(v->name, "language")) {
 			ast_copy_string(device->language, v->value, sizeof(device->language));
 		} else if (!strcasecmp(v->name, "regexten")) {
-			ast_copy_string(device->regexten, v->value, sizeof(device->regexten));
+			ast_string_field_set(device, subscribecontext, v->value);
+			//ast_copy_string(device->regexten, v->value, sizeof(device->regexten));
 		} else if (!strcasecmp(v->name, "call-limit")) {
 			device->call_limit = atoi(v->value);
 			if (device->call_limit < 0)
@@ -480,12 +501,14 @@
 		} else if (!strcasecmp(v->name, "mohsuggest")) {
 			ast_copy_string(device->mohsuggest, v->value, sizeof(device->mohsuggest));
 		} else if (!strcasecmp(v->name, "mailbox")) {
-			ast_copy_string(device->mailbox, v->value, sizeof(device->mailbox));
+			ast_string_field_set(device, mailbox, v->value);
+			//ast_copy_string(device->mailbox, v->value, sizeof(device->mailbox));
 			sipcounters.peers_with_mwi++;
 		} else if (!strcasecmp(v->name, "subscribemwi")) {
 			ast_set2_flag(&device->flags[1], ast_true(v->value), SIP_PAGE2_SUBSCRIBEMWIONLY);
 		} else if (!strcasecmp(v->name, "vmexten")) {
-			ast_copy_string(device->vmexten, v->value, sizeof(device->vmexten));
+			ast_string_field_set(device, vmexten, v->value);
+			//ast_copy_string(device->vmexten, v->value, sizeof(device->vmexten));
 		} else if (!strcasecmp(v->name, "callgroup")) {
 			device->callgroup = ast_get_group(v->value);
 		} else if (!strcasecmp(v->name, "allowtransfer")) {
@@ -654,6 +677,7 @@
 	/*!< This is default: NO MMR and JBIG trancoding, NO fill bit removal, transferredTCF TCF, UDP FEC, Version 0 and 9600 max fax rate */
 	global->t38_capability = T38FAX_VERSION_0 | T38FAX_RATE_2400 | T38FAX_RATE_4800 | T38FAX_RATE_7200 | T38FAX_RATE_9600;
 
+	global->maxforwards = DEFAULT_MAX_FORWARDS;
 	global->tos_sip = DEFAULT_TOS_SIP;
 	global->tos_audio = DEFAULT_TOS_AUDIO;
 	global->tos_video = DEFAULT_TOS_VIDEO;
@@ -788,6 +812,10 @@
 			ast_set2_flag(&global.flags[1], ast_true(v->value), SIP_PAGE2_RTCACHEFRIENDS);	
 		} else if (!strcasecmp(v->name, "rtsavesysname")) {
 			ast_set2_flag(&global.flags[1], ast_true(v->value), SIP_PAGE2_RTSAVE_SYSNAME);	
+		} else if (!strcasecmp(v->name, "maxforwards")) {
+			global.maxforwards = atoi(v->value);
+			if (global.maxforwards < 1)
+				global.maxforwards = DEFAULT_MAX_FORWARDS;
 		} else if (!strcasecmp(v->name, "rtupdate")) {
 			ast_set2_flag(&global.flags[1], ast_true(v->value), SIP_PAGE2_RTUPDATE);	
 		} else if (!strcasecmp(v->name, "ignoreregexpire")) {

Modified: team/oej/codename-pineapple/channels/sip3/sip3_services.c
URL: http://svn.digium.com/view/asterisk/team/oej/codename-pineapple/channels/sip3/sip3_services.c?view=diff&rev=48284&r1=48283&r2=48284
==============================================================================
--- team/oej/codename-pineapple/channels/sip3/sip3_services.c (original)
+++ team/oej/codename-pineapple/channels/sip3/sip3_services.c Tue Dec  5 15:40:59 2006
@@ -511,7 +511,7 @@
 	add_header(&req, "Call-ID", p->callid);
 	add_header(&req, "CSeq", tmp);
 	add_header(&req, "User-Agent", global.useragent);
-	add_header(&req, "Max-Forwards", DEFAULT_MAX_FORWARDS);
+	add_header(&req, "Max-Forwards", global.maxforwards);
 
 	
 	if (auth) 	/* Add auth header */

Modified: team/oej/codename-pineapple/configs/sip3.conf.sample
URL: http://svn.digium.com/view/asterisk/team/oej/codename-pineapple/configs/sip3.conf.sample?view=diff&rev=48284&r1=48283&r2=48284
==============================================================================
--- team/oej/codename-pineapple/configs/sip3.conf.sample (original)
+++ team/oej/codename-pineapple/configs/sip3.conf.sample Tue Dec  5 15:40:59 2006
@@ -110,8 +110,6 @@
 				; and subscriptions (seconds)
 ;minexpiry=60			; Minimum length of registrations/subscriptions (default 60)
 ;defaultexpiry=120		; Default length of incoming/outgoing registration
-;t1min=100			; Minimum roundtrip time for messages to monitored hosts
-				; Defaults to 100 ms
 ;notifymimetype=text/plain	; Allow overriding of mime type in MWI NOTIFY
 ;checkmwi=10			; Default time between mailbox checks for peers
 ;vmexten=voicemail		; dialplan extension to reach mailbox sets the 
@@ -177,10 +175,6 @@
 				; contrary to the RFC3551 specification, the peer _should_
 				; be negotiating AAL2-G726-32 instead :-(
 
-;default-qualify-ok = 30	; Set default time between OPTIONS packets when qualify=yes
-				; Default is 60. Recommended for NAT keepalives is 30 secs
-;default-qualify-notok = 10	; How often to check when NOT ok
-
 ;
 ; If regcontext is specified, Asterisk will dynamically create and destroy a
 ; NoOp priority 1 extension for a given peer who registers or unregisters with
@@ -427,6 +421,15 @@
                               ; variable size, actually the new jb of IAX2). Defaults to fixed.
 
 ; jblog = no                  ; Enables jitterbuffer frame logging. Defaults to "no".
+;------------------------------ ADVANCED CONFIGURATION -----------------------------
+;maxforwards = 70		; Set the Max forards (TTL) header for outbound SIP requests
+				; Default= 70
+;t1min=100			; Minimum roundtrip time for messages to monitored hosts
+				; Defaults to 100 ms
+;default-qualify-ok = 30	; Set default time between OPTIONS packets when qualify=yes
+				; Default is 60. Recommended for NAT keepalives is 30 secs
+;default-qualify-notok = 10	; How often to check when NOT ok
+
 ;-----------------------------------------------------------------------------------
 
 [authentication]



More information about the asterisk-commits mailing list