[asterisk-commits] branch group/autoconf_and_menuselect r18538 - in /team/group/autoconf_and_men...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Sat Apr 8 14:12:17 MST 2006


Author: russell
Date: Sat Apr  8 16:12:09 2006
New Revision: 18538

URL: http://svn.digium.com/view/asterisk?rev=18538&view=rev
Log:
Merged revisions 18307,18309,18342,18369-18371,18373,18403,18437,18492-18493,18495 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

................
r18307 | oej | 2006-04-07 12:22:28 -0400 (Fri, 07 Apr 2006) | 4 lines

- sip_alloc failures are also caused by too few available file descriptors, so we can not
  open socket for RTP (audio/video/rtcp).
  Error message change to clarify.

................
r18309 | russell | 2006-04-07 12:28:50 -0400 (Fri, 07 Apr 2006) | 3 lines

change a couple uses of !strlen() to ast_strlen_zero().  Oddly enough, one of
these used to be this way and got changed ...

................
r18342 | oej | 2006-04-07 14:52:23 -0400 (Fri, 07 Apr 2006) | 2 lines

Hmm. What is that keyword?? Let me see... Wait... Maybe... Ahh! OOPS!

................
r18369 | oej | 2006-04-07 15:11:22 -0400 (Fri, 07 Apr 2006) | 4 lines

Issue #6899 - remove OSP support code from chan_sip.c and app_dial.c 
- implement all functions through internal APIs in res_osp.c and app_osplookup.c
(homesick)

................
r18370 | oej | 2006-04-07 15:25:19 -0400 (Fri, 07 Apr 2006) | 2 lines

Add some more information to SIP history

................
r18371 | oej | 2006-04-07 15:36:44 -0400 (Fri, 07 Apr 2006) | 2 lines

make history easier to read

................
r18373 | oej | 2006-04-07 15:46:50 -0400 (Fri, 07 Apr 2006) | 3 lines

Add history events for re-invites
(need to nail this issue...)

................
r18403 | oej | 2006-04-07 16:19:44 -0400 (Fri, 07 Apr 2006) | 2 lines

-Fixing some debugging messages in history and console

................
r18437 | tilghman | 2006-04-07 18:11:12 -0400 (Fri, 07 Apr 2006) | 10 lines

Merged revisions 18436 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r18436 | tilghman | 2006-04-07 17:07:38 -0500 (Fri, 07 Apr 2006) | 2 lines

Bug 6913 - fix for possible buffer overflow

........

................
r18492 | russell | 2006-04-08 15:13:37 -0400 (Sat, 08 Apr 2006) | 3 lines

remove traces of "look", something that does not exist in the tree
(issue #6904)

................
r18493 | russell | 2006-04-08 15:16:38 -0400 (Sat, 08 Apr 2006) | 2 lines

fix bug in smdi config parsing (issue #6908)

................
r18495 | tilghman | 2006-04-08 15:22:29 -0400 (Sat, 08 Apr 2006) | 10 lines

Merged revisions 18494 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r18494 | tilghman | 2006-04-08 14:20:45 -0500 (Sat, 08 Apr 2006) | 2 lines

Bug 6914 - .txt file fails to rename on operator out

........

................

Modified:
    team/group/autoconf_and_menuselect/   (props changed)
    team/group/autoconf_and_menuselect/UPGRADE.txt
    team/group/autoconf_and_menuselect/apps/Makefile
    team/group/autoconf_and_menuselect/apps/app_dial.c
    team/group/autoconf_and_menuselect/apps/app_osplookup.c
    team/group/autoconf_and_menuselect/apps/app_voicemail.c
    team/group/autoconf_and_menuselect/channels/chan_sip.c
    team/group/autoconf_and_menuselect/configs/osp.conf.sample
    team/group/autoconf_and_menuselect/doc/channelvariables.txt
    team/group/autoconf_and_menuselect/formats/format_jpeg.c
    team/group/autoconf_and_menuselect/include/asterisk/astosp.h
    team/group/autoconf_and_menuselect/res/res_osp.c
    team/group/autoconf_and_menuselect/res/res_smdi.c

Propchange: team/group/autoconf_and_menuselect/
------------------------------------------------------------------------------
Binary property 'branch-1.2-merged' - no diff available.

Propchange: team/group/autoconf_and_menuselect/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Sat Apr  8 16:12:09 2006
@@ -14,14 +14,3 @@
 tags
 TAGS
 testexpr2
-makeopts
-menuselect.makeopts
-config.status
-config.log
-makeopts.xml
-aclocal.m4
-install-sh
-configure
-mkinstalldirs
-autom4te.cache
-missing

Propchange: team/group/autoconf_and_menuselect/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Sat Apr  8 16:12:09 2006
@@ -1,1 +1,1 @@
-/trunk:1-18297
+/trunk:1-18537

Modified: team/group/autoconf_and_menuselect/UPGRADE.txt
URL: http://svn.digium.com/view/asterisk/team/group/autoconf_and_menuselect/UPGRADE.txt?rev=18538&r1=18537&r2=18538&view=diff
==============================================================================
--- team/group/autoconf_and_menuselect/UPGRADE.txt (original)
+++ team/group/autoconf_and_menuselect/UPGRADE.txt Sat Apr  8 16:12:09 2006
@@ -29,6 +29,8 @@
   "noanswer" will not work.  Use s or n.  Also there is a new feature i, for
   using indication tones, so typing in skip would give you unexpected results.
 
+* OSPAuth is added to authenticate OSP tokens in in_bound call setup messages.
+
 Variables:
 
 * The builtin variables ${CALLERID}, ${CALLERIDNAME}, ${CALLERIDNUM},
@@ -39,6 +41,10 @@
 
 * The CDR-CSV variables uniqueid, userfield, and basing time on GMT are now 
   adjustable from cdr.conf, instead of recompiling.
+
+* OSP applications exports several new variables, ${OSPINHANDLE},
+  ${OSPOUTHANDLE}, ${OSPINTOKEN}, ${OSPOUTTOKEN}, ${OSPCALLING},
+  ${OSPINTIMELIMIT}, and ${OSPOUTTIMELIMIT}
 
 Functions:
 
@@ -66,6 +72,10 @@
 
 * The "incominglimit" setting is replaced by the "call-limit" setting in sip.conf.
 
+* OSP support code is removed from SIP channel to OSP applications. ospauth 
+  option in sip.conf is removed to osp.conf as authpolicy. allowguest option
+  in sip.conf cannot be set as osp anymore. 
+
 Installation:
 
 * 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

Modified: team/group/autoconf_and_menuselect/apps/Makefile
URL: http://svn.digium.com/view/asterisk/team/group/autoconf_and_menuselect/apps/Makefile?rev=18538&r1=18537&r2=18538&view=diff
==============================================================================
--- team/group/autoconf_and_menuselect/apps/Makefile (original)
+++ team/group/autoconf_and_menuselect/apps/Makefile Sat Apr  8 16:12:09 2006
@@ -40,7 +40,7 @@
 	rm -f .depend
 
 clean: clean-depend
-	rm -f *.so *.o look
+	rm -f *.so *.o
 
 %.so : %.o
 	$(CC) $(SOLINK) -o $@ ${CYGSOLINK} $< ${CYGSOLIB}
@@ -56,14 +56,10 @@
 
 uninstall:
 
-look:	look.c
-	$(CC) -pipe -O6 -g look.c -o look -lncurses
-
 ifeq (SunOS,$(shell uname))
 app_chanspy.so: app_chanspy.o
 	$(CC) $(SOLINK) -o $@ $< -lrt
 endif
-
 
 ifneq ($(wildcard .depend),)
  include .depend

Modified: team/group/autoconf_and_menuselect/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/team/group/autoconf_and_menuselect/apps/app_dial.c?rev=18538&r1=18537&r2=18538&view=diff
==============================================================================
--- team/group/autoconf_and_menuselect/apps/app_dial.c (original)
+++ team/group/autoconf_and_menuselect/apps/app_dial.c Sat Apr  8 16:12:09 2006
@@ -1189,10 +1189,6 @@
 	}
 	if (peer) {
 		time(&answer_time);
-#ifdef OSP_SUPPORT
-		/* Once call is answered, ditch the OSP Handle */
-		pbx_builtin_setvar_helper(chan, "_OSPHANDLE", "");
-#endif
 		strcpy(status, "ANSWER");
 		/* Ah ha!  Someone answered within the desired timeframe.  Of course after this
 		   we will always return with -1 so that it is hung up properly after the 

Modified: team/group/autoconf_and_menuselect/apps/app_osplookup.c
URL: http://svn.digium.com/view/asterisk/team/group/autoconf_and_menuselect/apps/app_osplookup.c?rev=18538&r1=18537&r2=18538&view=diff
==============================================================================
--- team/group/autoconf_and_menuselect/apps/app_osplookup.c (original)
+++ team/group/autoconf_and_menuselect/apps/app_osplookup.c Sat Apr  8 16:12:09 2006
@@ -16,9 +16,9 @@
  * at the top of the source tree.
  */
 
-/*! \file
- *
- * \brief Open Settlement Protocol Lookup
+/*!
+ * \file
+ * \brief Open Settlement Protocol Applications
  *
  * \author Mark Spencer <markster at digium.com>
  * 
@@ -49,44 +49,55 @@
 #include "asterisk/app.h"
 #include "asterisk/options.h"
 
-static char *tdesc = "OSP Lookup";
-
-static char *app = "OSPLookup";
-static char *app2 = "OSPNext";
-static char *app3 = "OSPFinish";
-
-static char *synopsis = "Lookup number in OSP";
-static char *synopsis2 = "Lookup next OSP entry";
-static char *synopsis3 = "Record OSP entry";
-
-static char *descrip = 
+static char *app1= "OSPAuth";
+static char *synopsis1 = "OSP authentication";
+static char *descrip1 = 
+"  OSPAuth([provider[|options]]):  Authenticate a SIP INVITE by OSP and sets\n"
+"the variables:\n"
+" ${OSPINHANDLE}:  The in_bound call transaction handle\n"
+" ${OSPINTIMELIMIT}:  The in_bound call duration limit in seconds\n"
+"\n"
+"The option string may contain the following character:\n"
+"	'j' -- jump to n+101 priority if the authentication was NOT successful\n"
+"This application sets the following channel variable upon completion:\n"
+"	OSPAUTHSTATUS	The status of the OSP Auth attempt as a text string, one of\n"
+"		SUCCESS | FAILED | ERROR\n";
+
+static char *app2= "OSPLookup";
+static char *synopsis2 = "Lookup destination by OSP";
+static char *descrip2 = 
 "  OSPLookup(exten[|provider[|options]]):  Looks up an extension via OSP and sets\n"
 "the variables, where 'n' is the number of the result beginning with 1:\n"
-" ${OSPTECH}:   The technology to use for the call\n"
-" ${OSPDEST}:   The destination to use for the call\n"
-" ${OSPTOKEN}:  The actual OSP token as a string\n"
-" ${OSPHANDLE}: The OSP Handle for anything remaining\n"
-" ${OSPRESULTS}: The number of OSP results total remaining\n"
+" ${OSPOUTHANDLE}:  The OSP Handle for anything remaining\n"
+" ${OSPTECH}:  The technology to use for the call\n"
+" ${OSPDEST}:  The destination to use for the call\n"
+" ${OSPCALLING}:  The calling number to use for the call\n"
+" ${OSPOUTTOKEN}:  The actual OSP token as a string\n"
+" ${OSPOUTTIMELIMIT}:  The out_bound call duration limit in seconds\n"
+" ${OSPRESULTS}:  The number of OSP results total remaining\n"
 "\n"
 "The option string may contain the following character:\n"
 "	'j' -- jump to n+101 priority if the lookup was NOT successful\n"
 "This application sets the following channel variable upon completion:\n"
 "	OSPLOOKUPSTATUS	The status of the OSP Lookup attempt as a text string, one of\n"
-"		SUCCESS | FAILED \n";
-
-
-static char *descrip2 = 
-"  OSPNext(cause[|options]):  Looks up the next OSP Destination for ${OSPHANDLE}\n"
+"		SUCCESS | FAILED | ERROR\n";
+
+static char *app3 = "OSPNext";
+static char *synopsis3 = "Lookup next destination by OSP";
+static char *descrip3 = 
+"  OSPNext(cause[|options]):  Looks up the next OSP Destination for ${OSPOUTHANDLE}\n"
 "See OSPLookup for more information\n"
 "\n"
 "The option string may contain the following character:\n"
 "	'j' -- jump to n+101 priority if the lookup was NOT successful\n"
 "This application sets the following channel variable upon completion:\n"
 "	OSPNEXTSTATUS	The status of the OSP Next attempt as a text string, one of\n"
-"		SUCCESS | FAILED \n";
-
-static char *descrip3 = 
-"  OSPFinish(status[|options]):  Records call state for ${OSPHANDLE}, according to\n"
+"		SUCCESS | FAILED |ERROR\n";
+
+static char *app4 = "OSPFinish";
+static char *synopsis4 = "Record OSP entry";
+static char *descrip4 = 
+"  OSPFinish([status[|options]]):  Records call state for ${OSPINHANDLE}, according to\n"
 "status, which should be one of BUSY, CONGESTION, ANSWER, NOANSWER, or CHANUNAVAIL\n"
 "or coincidentally, just what the Dial application stores in its ${DIALSTATUS}.\n"
 "\n"
@@ -94,279 +105,547 @@
 "	'j' -- jump to n+101 priority if the finish attempt was NOT successful\n"
 "This application sets the following channel variable upon completion:\n"
 "	OSPFINISHSTATUS	The status of the OSP Finish attempt as a text string, one of\n"
-"		SUCCESS | FAILED \n";
+"		SUCCESS | FAILED |ERROR \n";
 
 LOCAL_USER_DECL;
 
-static int str2cause(char *cause)
-{
-	if (!strcasecmp(cause, "BUSY"))
-		return AST_CAUSE_BUSY;
-	if (!strcasecmp(cause, "CONGESTION"))
-		return AST_CAUSE_CONGESTION;
-	if (!strcasecmp(cause, "ANSWER"))
-		return AST_CAUSE_NORMAL;
-	if (!strcasecmp(cause, "CANCEL"))
-		return AST_CAUSE_NORMAL;
-	if (!strcasecmp(cause, "NOANSWER"))
-		return AST_CAUSE_NOANSWER;
-	if (!strcasecmp(cause, "NOCHANAVAIL"))
-		return AST_CAUSE_CONGESTION;
-	ast_log(LOG_WARNING, "Unknown cause '%s', using NORMAL\n", cause);
-	return AST_CAUSE_NORMAL;
+static int ospauth_exec(struct ast_channel *chan, void *data)
+{
+	int res = 0;
+	struct localuser* u;
+	char* provider = OSP_DEF_PROVIDER;
+	int priority_jump = 0;
+	struct varshead* headp;
+	struct ast_var_t* current;
+	const char* source = "";
+	const char* token = "";
+	int handle;
+	unsigned int timelimit;
+	char* tmp;
+	char buffer[OSP_INTSTR_SIZE];
+	char* status;
+
+	AST_DECLARE_APP_ARGS(args,
+		AST_APP_ARG(provider);
+		AST_APP_ARG(options);
+	);
+
+	LOCAL_USER_ADD(u);
+
+	if (!(tmp = ast_strdupa(data))) {
+		ast_log(LOG_ERROR, "Out of memory\n");
+		LOCAL_USER_REMOVE(u);
+		return(-1);
+	}
+
+	AST_STANDARD_APP_ARGS(args, tmp);
+
+	if (!ast_strlen_zero(args.provider)) {
+		provider = args.provider;
+	}
+	ast_log(LOG_DEBUG, "OSPAuth: provider '%s'\n", provider);
+
+	if (args.options) {
+		if (strchr(args.options, 'j')) {
+			priority_jump = 1;
+		}
+	}
+	ast_log(LOG_DEBUG, "OSPAuth: priority jump '%d'\n", priority_jump);
+
+	headp = &chan->varshead;
+	AST_LIST_TRAVERSE(headp, current, entries) {
+		if (!strcasecmp(ast_var_name(current), "OSPPEERIP")) {
+			source = ast_var_value(current);
+		} else if (!strcasecmp(ast_var_name(current), "OSPINTOKEN")) {
+			token = ast_var_value(current);
+		}
+	}
+	ast_log(LOG_DEBUG, "OSPAuth: source '%s'\n", source);
+	ast_log(LOG_DEBUG, "OSPAuth: token size '%d'\n", strlen(token));
+
+	res = ast_osp_auth(provider, &handle, source, chan->cid.cid_num, chan->exten, token, &timelimit);
+	if (res > 0) {
+		status = OSP_APP_SUCCESS;
+	} else {
+		timelimit = OSP_DEF_TIMELIMIT;
+		if (!res) {
+			status = OSP_APP_FAILED;
+		} else {
+			handle = OSP_INVALID_HANDLE;
+			status = OSP_APP_ERROR;
+		}
+	}
+
+	snprintf(buffer, sizeof(buffer), "%d", handle);
+	pbx_builtin_setvar_helper(chan, "OSPINHANDLE", buffer);
+	ast_log(LOG_DEBUG, "OSPAuth: OSPINHANDLE '%s'\n", buffer);
+	snprintf(buffer, sizeof(buffer), "%d", timelimit);
+	pbx_builtin_setvar_helper(chan, "OSPINTIMELIMIT", buffer);
+	ast_log(LOG_DEBUG, "OSPAuth: OSPINTIMELIMIT '%s'\n", buffer);
+	pbx_builtin_setvar_helper(chan, "OSPAUTHSTATUS", status);
+	ast_log(LOG_DEBUG, "OSPAuth: %s\n", status);
+
+	if(!res) {
+		if (priority_jump || ast_opt_priority_jumping) {
+			ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 101);
+		} else {
+			res = -1;
+		}
+	} else if (res > 0) {
+		res = 0;
+	}
+
+	LOCAL_USER_REMOVE(u);
+
+	return(res);
 }
 
 static int osplookup_exec(struct ast_channel *chan, void *data)
 {
-	int res=0;
-	struct localuser *u;
-	char *temp;
+	int res = 0;
+	struct localuser* u;
+	char* provider = OSP_DEF_PROVIDER;
+	int priority_jump = 0;
+	struct varshead* headp;
+	struct ast_var_t* current;
+	const char* srcdev = "";
+	char* tmp;
+	char buffer[OSP_TOKSTR_SIZE];
 	struct ast_osp_result result;
-	int priority_jump = 0;
+	char* status;
+
 	AST_DECLARE_APP_ARGS(args,
-		AST_APP_ARG(extension);
+		AST_APP_ARG(exten);
 		AST_APP_ARG(provider);
 		AST_APP_ARG(options);
 	);
 	
 	if (ast_strlen_zero(data)) {
-		ast_log(LOG_WARNING, "OSPLookup requires an argument OSPLookup(exten[|provider[|options]])\n");
-		return -1;
+		ast_log(LOG_WARNING, "OSPLookup: Arg required, OSPLookup(exten[|provider[|options]])\n");
+		return(-1);
 	}
 
 	LOCAL_USER_ADD(u);
 
-	if (!(temp = ast_strdupa(data))) {
+	if (!(tmp = ast_strdupa(data))) {
+		ast_log(LOG_ERROR, "Out of memory\n");
 		LOCAL_USER_REMOVE(u);
-		return -1;
-	}
-
-	AST_STANDARD_APP_ARGS(args, temp);
+		return(-1);
+	}
+
+	AST_STANDARD_APP_ARGS(args, tmp);
+
+	ast_log(LOG_DEBUG, "OSPLookup: exten '%s'\n", args.exten);
+
+	if (!ast_strlen_zero(args.provider)) {
+		provider = args.provider;
+	}
+	ast_log(LOG_DEBUG, "OSPlookup: provider '%s'\n", provider);
 
 	if (args.options) {
-		if (strchr(args.options, 'j'))
+		if (strchr(args.options, 'j')) {
 			priority_jump = 1;
-	}
-
-	ast_log(LOG_DEBUG, "Whoo hoo, looking up OSP on '%s' via '%s'\n", args.extension, args.provider ? args.provider : "<default>");
-	if ((res = ast_osp_lookup(chan, args.provider, args.extension, chan->cid.cid_num, &result)) > 0) {
-		char tmp[80];
-		snprintf(tmp, sizeof(tmp), "%d", result.handle);
-		pbx_builtin_setvar_helper(chan, "_OSPHANDLE", tmp);
-		pbx_builtin_setvar_helper(chan, "_OSPTECH", result.tech);
-		pbx_builtin_setvar_helper(chan, "_OSPDEST", result.dest);
-		pbx_builtin_setvar_helper(chan, "_OSPTOKEN", result.token);
-		snprintf(tmp, sizeof(tmp), "%d", result.numresults);
-		pbx_builtin_setvar_helper(chan, "_OSPRESULTS", tmp);
-		pbx_builtin_setvar_helper(chan, "OSPLOOKUPSTATUS", "SUCCESS");
-
+		}
+	}
+	ast_log(LOG_DEBUG, "OSPLookup: priority jump '%d'\n", priority_jump);
+
+	result.inhandle = OSP_INVALID_HANDLE;
+
+	headp = &chan->varshead;
+	AST_LIST_TRAVERSE(headp, current, entries) {
+		if (!strcasecmp(ast_var_name(current), "OSPINHANDLE")) {
+			if (sscanf(ast_var_value(current), "%d", &result.inhandle) != 1) {
+				result.inhandle = OSP_INVALID_HANDLE;
+			}
+		} else if (!strcasecmp(ast_var_name(current), "OSPINTIMELIMIT")) {
+			if (sscanf(ast_var_value(current), "%d", &result.intimelimit) != 1) {
+				result.intimelimit = OSP_DEF_TIMELIMIT;
+			}
+		} else if (!strcasecmp(ast_var_name(current), "OSPPEERIP")) {
+			srcdev = ast_var_value(current);
+		}
+	}
+	ast_log(LOG_DEBUG, "OSPLookup: OSPINHANDLE '%d'\n", result.inhandle);
+	ast_log(LOG_DEBUG, "OSPLookup: OSPINTIMELIMIT '%d'\n", result.intimelimit);
+	ast_log(LOG_DEBUG, "OSPLookup: source device '%s'\n", srcdev);
+
+	res = ast_osp_lookup(provider, srcdev, chan->cid.cid_num, args.exten, &result);
+	if (res > 0) {
+		status = OSP_APP_SUCCESS;
 	} else {
+		result.tech[0] = '\0';
+		result.dest[0] = '\0';
+		result.calling[0] = '\0';
+		result.token[0] = '\0'; 
+		result.numresults = 0;
+		result.outtimelimit = OSP_DEF_TIMELIMIT;
 		if (!res) {
-			ast_log(LOG_NOTICE, "OSP Lookup failed for '%s' (provider '%s')\n", args.extension, args.provider ? args.provider : "<default>");
-			pbx_builtin_setvar_helper(chan, "OSPLOOKUPSTATUS", "FAILED");
-		} else
-			ast_log(LOG_DEBUG, "Got hangup on '%s' while doing OSP Lookup for '%s' (provider '%s')!\n", chan->name, args.extension, args.provider ? args.provider : "<default>" );
-	}
-	if (!res) {
-		/* Look for a "busy" place */
-		if (priority_jump || ast_opt_priority_jumping)
+			status = OSP_APP_FAILED;
+		} else {
+			result.outhandle = OSP_INVALID_HANDLE;
+			status = OSP_APP_ERROR;
+		}
+	}
+
+	snprintf(buffer, sizeof(buffer), "%d", result.outhandle);
+	pbx_builtin_setvar_helper(chan, "OSPOUTHANDLE", buffer);
+	ast_log(LOG_DEBUG, "OSPLookup: OSPOUTHANDLE '%s'\n", buffer);
+	pbx_builtin_setvar_helper(chan, "OSPTECH", result.tech);
+	ast_log(LOG_DEBUG, "OSPLookup: OSPTECH '%s'\n", result.tech);
+	pbx_builtin_setvar_helper(chan, "OSPDEST", result.dest);
+	ast_log(LOG_DEBUG, "OSPLookup: OSPDEST '%s'\n", result.dest);
+	pbx_builtin_setvar_helper(chan, "OSPCALLING", result.calling);
+	ast_log(LOG_DEBUG, "OSPLookup: OSPCALLING '%s'\n", result.calling);
+	pbx_builtin_setvar_helper(chan, "OSPOUTTOKEN", result.token);
+	ast_log(LOG_DEBUG, "OSPLookup: OSPOUTTOKEN size '%d'\n", strlen(result.token));
+	if (!ast_strlen_zero(result.token)) {
+		snprintf(buffer, sizeof(buffer), "P-OSP-Auth-Token: %s", result.token);
+		pbx_builtin_setvar_helper(chan, "_SIPADDHEADER", buffer);
+		ast_log(LOG_DEBUG, "OSPLookup: SIPADDHEADER size '%d'\n", strlen(buffer));
+	}
+	snprintf(buffer, sizeof(buffer), "%d", result.numresults);
+	pbx_builtin_setvar_helper(chan, "OSPRESULTS", buffer);
+	ast_log(LOG_DEBUG, "OSPLookup: OSPRESULTS '%s'\n", buffer);
+	snprintf(buffer, sizeof(buffer), "%d", result.outtimelimit);
+	pbx_builtin_setvar_helper(chan, "OSPOUTTIMELIMIT", buffer);
+	ast_log(LOG_DEBUG, "OSPLookup: OSPOUTTIMELIMIT '%s'\n", buffer);
+	pbx_builtin_setvar_helper(chan, "OSPLOOKUPSTATUS", status);
+	ast_log(LOG_DEBUG, "OSPLookup: %s\n", status);
+
+	if(!res) {
+		if (priority_jump || ast_opt_priority_jumping) {
 			ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 101);
-	} else if (res > 0)
+		} else {
+			res = -1;
+		}
+	} else if (res > 0) {
 		res = 0;
+	}
+
 	LOCAL_USER_REMOVE(u);
-	return res;
+
+	return(res);
+}
+
+static int str2cause(char *str)
+{
+	int cause = AST_CAUSE_NORMAL;
+
+	if (ast_strlen_zero(str)) {
+		cause = AST_CAUSE_NOTDEFINED;
+	} else if (!strcasecmp(str, "BUSY")) {
+		cause = AST_CAUSE_BUSY;
+	} else if (!strcasecmp(str, "CONGESTION")) {
+		cause = AST_CAUSE_CONGESTION;
+	} else if (!strcasecmp(str, "ANSWER")) {
+		cause = AST_CAUSE_NORMAL;
+	} else if (!strcasecmp(str, "CANCEL")) {
+		cause = AST_CAUSE_NORMAL;
+	} else if (!strcasecmp(str, "NOANSWER")) {
+		cause = AST_CAUSE_NOANSWER;
+	} else if (!strcasecmp(str, "NOCHANAVAIL")) {
+		cause = AST_CAUSE_CONGESTION;
+	} else {
+		ast_log(LOG_WARNING, "OSP: Unknown cause '%s', using NORMAL\n", str);
+	}
+
+	return(cause);
 }
 
 static int ospnext_exec(struct ast_channel *chan, void *data)
 {
 	int res=0;
 	struct localuser *u;
-	char *temp;
-	const char *val;
+	int priority_jump = 0;
 	int cause;
+	struct varshead* headp;
+	struct ast_var_t* current;
 	struct ast_osp_result result;
-	int priority_jump = 0;
+	char *tmp;
+	char buffer[OSP_TOKSTR_SIZE];
+	char* status;
+
 	AST_DECLARE_APP_ARGS(args,
 		AST_APP_ARG(cause);
 		AST_APP_ARG(options);
 	);
 	
 	if (ast_strlen_zero(data)) {
-		ast_log(LOG_WARNING, "OSPNext should have an argument (cause[|options])\n");
-		return -1;
+		ast_log(LOG_WARNING, "OSPNext: Arg required, OSPNext(cause[|options])\n");
+		return(-1);
 	}
 
 	LOCAL_USER_ADD(u);
 
-	if (!(temp = ast_strdupa(data))) {
+	if (!(tmp = ast_strdupa(data))) {
+		ast_log(LOG_ERROR, "Out of memory\n");
 		LOCAL_USER_REMOVE(u);
-		return -1;
-	}
-
-	AST_STANDARD_APP_ARGS(args, temp);
+		return(-1);
+	}
+
+	AST_STANDARD_APP_ARGS(args, tmp);
+
+	cause = str2cause(args.cause);
+	ast_log(LOG_DEBUG, "OSPNext: cause '%d'\n", cause);
 
 	if (args.options) {
 		if (strchr(args.options, 'j'))
 			priority_jump = 1;
 	}
-
-	cause = str2cause(args.cause);
-	val = pbx_builtin_getvar_helper(chan, "OSPHANDLE");
-	result.handle = -1;
-	if (!ast_strlen_zero(val) && (sscanf(val, "%d", &result.handle) == 1) && (result.handle > -1)) {
-		val = pbx_builtin_getvar_helper(chan, "OSPRESULTS");
-		if (ast_strlen_zero(val) || (sscanf(val, "%d", &result.numresults) != 1)) {
-			result.numresults = 0;
-		}
-		if ((res = ast_osp_next(&result, cause)) > 0) {
-			char tmp[80];
-			snprintf(tmp, sizeof(tmp), "%d", result.handle);
-			pbx_builtin_setvar_helper(chan, "_OSPHANDLE", tmp);
-			pbx_builtin_setvar_helper(chan, "_OSPTECH", result.tech);
-			pbx_builtin_setvar_helper(chan, "_OSPDEST", result.dest);
-			pbx_builtin_setvar_helper(chan, "_OSPTOKEN", result.token);
-			snprintf(tmp, sizeof(tmp), "%d", result.numresults);
-			pbx_builtin_setvar_helper(chan, "_OSPRESULTS", tmp);
-			pbx_builtin_setvar_helper(chan, "OSPNEXTSTATUS", "SUCCESS");
-		}
+	ast_log(LOG_DEBUG, "OSPNext: priority jump '%d'\n", priority_jump);
+
+	result.inhandle = OSP_INVALID_HANDLE;
+	result.outhandle = OSP_INVALID_HANDLE;
+	result.numresults = 0;
+
+	headp = &chan->varshead;
+	AST_LIST_TRAVERSE(headp, current, entries) {
+		if (!strcasecmp(ast_var_name(current), "OSPINHANDLE")) {
+			if (sscanf(ast_var_value(current), "%d", &result.inhandle) != 1) {
+				result.inhandle = OSP_INVALID_HANDLE;
+			}
+		} else if (!strcasecmp(ast_var_name(current), "OSPOUTHANDLE")) {
+			if (sscanf(ast_var_value(current), "%d", &result.outhandle) != 1) {
+				result.outhandle = OSP_INVALID_HANDLE;
+			}
+		} else if (!strcasecmp(ast_var_name(current), "OSPINTIMEOUT")) {
+			if (sscanf(ast_var_value(current), "%d", &result.intimelimit) != 1) {
+				result.intimelimit = OSP_DEF_TIMELIMIT;
+			}
+		} else if (!strcasecmp(ast_var_name(current), "OSPRESULTS")) {
+			if (sscanf(ast_var_value(current), "%d", &result.numresults) != 1) {
+				result.numresults = 0;
+			}
+		}
+	}
+	ast_log(LOG_DEBUG, "OSPNext: OSPINHANDLE '%d'\n", result.inhandle);
+	ast_log(LOG_DEBUG, "OSPNext: OSPOUTHANDLE '%d'\n", result.outhandle);
+	ast_log(LOG_DEBUG, "OSPNext: OSPINTIMELIMIT '%d'\n", result.intimelimit);
+	ast_log(LOG_DEBUG, "OSPNext: OSPRESULTS '%d'\n", result.numresults);
+
+	if ((res = ast_osp_next(cause, &result)) > 0) {
+		status = OSP_APP_SUCCESS;
 	} else {
+		result.tech[0] = '\0';
+		result.dest[0] = '\0';
+		result.calling[0] = '\0';
+		result.token[0] = '\0'; 
+		result.numresults = 0;
+		result.outtimelimit = OSP_DEF_TIMELIMIT;
 		if (!res) {
-			if (result.handle < 0)
-				ast_log(LOG_NOTICE, "OSP Lookup Next failed for handle '%d'\n", result.handle);
-			else
-				ast_log(LOG_DEBUG, "No OSP handle specified\n");
-			pbx_builtin_setvar_helper(chan, "OSPNEXTSTATUS", "FAILED");	
-		} else
-			ast_log(LOG_DEBUG, "Got hangup on '%s' while doing OSP Next!\n", chan->name);
-	}
-	if (!res) {
-		/* Look for a "busy" place */
-		if (priority_jump || ast_opt_priority_jumping)
+			status = OSP_APP_FAILED;
+		} else {
+			result.outhandle = OSP_INVALID_HANDLE;
+			status = OSP_APP_ERROR;
+		}
+	}
+
+	pbx_builtin_setvar_helper(chan, "OSPTECH", result.tech);
+	ast_log(LOG_DEBUG, "OSPNext: OSPTECH '%s'\n", result.tech);
+	pbx_builtin_setvar_helper(chan, "OSPDEST", result.dest);
+	ast_log(LOG_DEBUG, "OSPNext: OSPDEST '%s'\n", result.dest);
+	pbx_builtin_setvar_helper(chan, "OSPCALLING", result.calling);
+	ast_log(LOG_DEBUG, "OSPNext: OSPCALLING '%s'\n", result.calling);
+	pbx_builtin_setvar_helper(chan, "OSPOUTTOKEN", result.token);
+	ast_log(LOG_DEBUG, "OSPNext: OSPOUTTOKEN size '%d'\n", strlen(result.token));
+	if (!ast_strlen_zero(result.token)) {
+		snprintf(buffer, sizeof(buffer), "P-OSP-Auth-Token: %s", result.token);
+		pbx_builtin_setvar_helper(chan, "_SIPADDHEADER", buffer);
+		ast_log(LOG_DEBUG, "OSPNext: SIPADDHEADER size '%d'\n", strlen(buffer));
+	}
+	snprintf(buffer, sizeof(buffer), "%d", result.numresults);
+	pbx_builtin_setvar_helper(chan, "OSPRESULTS", buffer);
+	ast_log(LOG_DEBUG, "OSPNext: OSPRESULTS '%s'\n", buffer);
+	snprintf(buffer, sizeof(buffer), "%d", result.outtimelimit);
+	pbx_builtin_setvar_helper(chan, "OSPOUTTIMELIMIT", buffer);
+	ast_log(LOG_DEBUG, "OSPNext: OSPOUTTIMELIMIT '%s'\n", buffer);
+	pbx_builtin_setvar_helper(chan, "OSPNEXTSTATUS", status);
+	ast_log(LOG_DEBUG, "OSPNext: %s\n", status);
+
+	if(!res) {
+		if (priority_jump || ast_opt_priority_jumping) {
 			ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 101);
-	} else if (res > 0)
+		} else {
+			res = -1;
+		}
+	} else if (res > 0) {
 		res = 0;
+	}
+
 	LOCAL_USER_REMOVE(u);
-	return res;
+
+	return(res);
 }
 
 static int ospfinished_exec(struct ast_channel *chan, void *data)
 {
-	int res=0;
-	struct localuser *u;
-	char *temp;
-	const char *val;
+	int res = 1;
+	struct localuser* u;
+	int priority_jump = 0;
 	int cause;
-	time_t start=0, duration=0;
-	struct ast_osp_result result;
-	int priority_jump = 0;
+	struct varshead* headp;
+	struct ast_var_t* current;
+	int inhandle = OSP_INVALID_HANDLE;
+	int outhandle = OSP_INVALID_HANDLE;
+	int recorded = 0;
+	time_t start, connect, end;
+	char* tmp;
+	char* str = "";
+	char buffer[OSP_INTSTR_SIZE];
+	char* status;
+
 	AST_DECLARE_APP_ARGS(args,
 		AST_APP_ARG(status);
 		AST_APP_ARG(options);
 	);
 	
-	if (ast_strlen_zero(data)) {
-		ast_log(LOG_WARNING, "OSPFinish should have an argument (status[|options])\n");
-		return -1;
-	}
-
 	LOCAL_USER_ADD(u);
 
-	if (!(temp = ast_strdupa(data))) {
+	if (!(tmp = ast_strdupa(data))) {
+		ast_log(LOG_ERROR, "Out of memory\n");
 		LOCAL_USER_REMOVE(u);
-		return -1;
-	}
-
-	AST_STANDARD_APP_ARGS(args, temp);
+		return(-1);
+	}
+
+	AST_STANDARD_APP_ARGS(args, tmp);
 
 	if (args.options) {
 		if (strchr(args.options, 'j'))
 			priority_jump = 1;
 	}
+	ast_log(LOG_DEBUG, "OSPFinish: priority jump '%d'\n", priority_jump);
+
+	headp = &chan->varshead;
+	AST_LIST_TRAVERSE(headp, current, entries) {
+		if (!strcasecmp(ast_var_name(current), "OSPINHANDLE")) {
+			if (sscanf(ast_var_value(current), "%d", &inhandle) != 1) {
+				inhandle = OSP_INVALID_HANDLE;
+			}
+		} else if (!strcasecmp(ast_var_name(current), "OSPOUTHANDLE")) {
+			if (sscanf(ast_var_value(current), "%d", &outhandle) != 1) {
+				outhandle = OSP_INVALID_HANDLE;
+			}
+		} else if (!recorded &&
+			(!strcasecmp(ast_var_name(current), "OSPAUTHSTATUS") ||
+			!strcasecmp(ast_var_name(current), "OSPLOOKUPSTATUS") || 
+			!strcasecmp(ast_var_name(current), "OSPNEXTSTATUS"))) 
+		{
+			if (strcasecmp(ast_var_value(current), OSP_APP_SUCCESS)) {
+				recorded = 1;
+			}
+		}
+	}
+	ast_log(LOG_DEBUG, "OSPFinish: OSPINHANDLE '%d'\n", inhandle);
+	ast_log(LOG_DEBUG, "OSPFinish: OSPOUTHANDLE '%d'\n", outhandle);
+	ast_log(LOG_DEBUG, "OSPFinish: recorded '%d'\n", recorded);
+
+	if (!recorded) {
+		str = args.status;
+	}
+	cause = str2cause(str);
+	ast_log(LOG_DEBUG, "OSPFinish: cause '%d'\n", cause);
 
 	if (chan->cdr) {
-		start = chan->cdr->answer.tv_sec;
-		if (start)
-			duration = time(NULL) - start;
-		else
-			duration = 0;
-	} else
-		ast_log(LOG_WARNING, "OSPFinish called on channel '%s' with no CDR!\n", chan->name);
-	
-	cause = str2cause(args.status);
-	val = pbx_builtin_getvar_helper(chan, "OSPHANDLE");
-	result.handle = -1;
-	if (!ast_strlen_zero(val) && (sscanf(val, "%d", &result.handle) == 1) && (result.handle > -1)) {
-		if (!ast_osp_terminate(result.handle, cause, start, duration)) {
-			pbx_builtin_setvar_helper(chan, "_OSPHANDLE", "");
-			pbx_builtin_setvar_helper(chan, "OSPFINISHSTATUS", "SUCCESS");
-			res = 1;
+		start = chan->cdr->start.tv_sec;
+		connect = chan->cdr->answer.tv_sec;
+		if (connect) {
+			end = time(NULL);
+		} else {
+			end = connect;
 		}
 	} else {
-		if (!res) {
-			if (result.handle > -1)
-				ast_log(LOG_NOTICE, "OSP Finish failed for handle '%d'\n", result.handle);
-			else
-				ast_log(LOG_DEBUG, "No OSP handle specified\n");
-			pbx_builtin_setvar_helper(chan, "OSPFINISHSTATUS", "FAILED");
-		} else
-			ast_log(LOG_DEBUG, "Got hangup on '%s' while doing OSP Terminate!\n", chan->name);
-	}
-	if (!res) {
-		/* Look for a "busy" place */
-		if (priority_jump || ast_opt_priority_jumping)
+		start = 0;
+		connect = 0;
+		end = 0;
+	}
+	ast_log(LOG_DEBUG, "OSPFinish: start '%ld'\n", start);
+	ast_log(LOG_DEBUG, "OSPFinish: connect '%ld'\n", connect);
+	ast_log(LOG_DEBUG, "OSPFinish: end '%ld'\n", end);
+
+	if (ast_osp_finish(outhandle, cause, start, connect, end) <= 0) {
+		ast_log(LOG_DEBUG, "OSPFinish: Unable to report usage for out_bound call\n");
+	}
+	if (ast_osp_finish(inhandle, cause, start, connect, end) <= 0) {
+		ast_log(LOG_DEBUG, "OSPFinish: Unable to report usage for in_bound call\n");
+	}
+	snprintf(buffer, sizeof(buffer), "%d", OSP_INVALID_HANDLE);
+	pbx_builtin_setvar_helper(chan, "OSPOUTHANDLE", buffer);
+	pbx_builtin_setvar_helper(chan, "OSPINHANDLE", buffer);
+
+	if (res > 0) {
+		status = OSP_APP_SUCCESS;
+	} else if (!res) {
+		status = OSP_APP_FAILED;
+	} else {
+		status = OSP_APP_ERROR;
+	}
+	pbx_builtin_setvar_helper(chan, "OSPFINISHSTATUS", status);
+
+	if(!res) {
+		if (priority_jump || ast_opt_priority_jumping) {
 			ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 101);
-	} else if (res > 0)
+		} else {
+			res = -1;
+		}
+	} else if (res > 0) {
 		res = 0;
+	}
+
 	LOCAL_USER_REMOVE(u);
-	return res;
-}
-
-
-int unload_module(void)
+
+	return(res);
+}
+
+int load_module(void)
 {
 	int res;
 	
-	res = ast_unregister_application(app3);
-	res |= ast_unregister_application(app2);
-	res |= ast_unregister_application(app);
-
-	STANDARD_HANGUP_LOCALUSERS;
-
-	return res;
-}
-
-int load_module(void)
+	ast_osp_adduse();
+
+	res = ast_register_application(app1, ospauth_exec, synopsis1, descrip1);
+	res |= ast_register_application(app2, osplookup_exec, synopsis2, descrip2);
+	res |= ast_register_application(app3, ospnext_exec, synopsis3, descrip3);
+	res |= ast_register_application(app4, ospfinished_exec, synopsis4, descrip4);
+
+	return(res);
+}
+
+int unload_module(void)
 {
 	int res;
 	
-	res = ast_register_application(app, osplookup_exec, synopsis, descrip);
-	res |= ast_register_application(app2, ospnext_exec, synopsis2, descrip2);
-	res |= ast_register_application(app3, ospfinished_exec, synopsis3, descrip3);
-	
-	return res;
+	res = ast_unregister_application(app4);
+	res |= ast_unregister_application(app3);
+	res |= ast_unregister_application(app2);
+	res |= ast_unregister_application(app1);
+
+	STANDARD_HANGUP_LOCALUSERS;
+
+	ast_osp_deluse();
+
+	return(res);
 }
 
 int reload(void)
 {
-	return 0;
-}
-
+	return(0);
+}
 
 char *description(void)
 {
-	return tdesc;
+	return("Open Settlement Protocol Applications");
 }
 
 int usecount(void)
 {
 	int res;
 	STANDARD_USECOUNT(res);
-	return res;
+	return(res);
 }
 
 char *key()
 {
-	return ASTERISK_GPL_KEY;
+	return(ASTERISK_GPL_KEY);
 }
 
 /*** MODULEINFO

Modified: team/group/autoconf_and_menuselect/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/team/group/autoconf_and_menuselect/apps/app_voicemail.c?rev=18538&r1=18537&r2=18538&view=diff
==============================================================================
--- team/group/autoconf_and_menuselect/apps/app_voicemail.c (original)
+++ team/group/autoconf_and_menuselect/apps/app_voicemail.c Sat Apr  8 16:12:09 2006
@@ -2593,8 +2593,10 @@
 				ast_log(LOG_WARNING, "Error opening text file for output\n");
 			res = play_record_review(chan, NULL, fn, vmmaxmessage, fmt, 1, vmu, &duration, dir, options->record_gain);
 			if (res == '0') {
-				if (txt)
+				if (txt) {
 					fclose(txt);
+					rename(tmptxtfile, txtfile);
+				}
 				goto transfer;
 			}
 			if (res > 0)

Modified: team/group/autoconf_and_menuselect/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/group/autoconf_and_menuselect/channels/chan_sip.c?rev=18538&r1=18537&r2=18538&view=diff
==============================================================================
--- team/group/autoconf_and_menuselect/channels/chan_sip.c (original)
+++ team/group/autoconf_and_menuselect/channels/chan_sip.c Sat Apr  8 16:12:09 2006
@@ -92,10 +92,6 @@
 #include "asterisk/linkedlists.h"
 #include "asterisk/stringfields.h"
 #include "asterisk/monitor.h"
-
-#ifdef OSP_SUPPORT
-#include "asterisk/astosp.h"
-#endif
 
 #ifndef FALSE
 #define FALSE	0
@@ -506,7 +502,6 @@
 /*! \brief Parameters to the transmit_invite function */
 struct sip_invite_param {
 	const char *distinctive_ring;	/*!< Distinctive ring header */
-	const char *osptoken;		/*!< OSP token for this call */
 	int addsipheaders;	/*!< Add extra SIP headers */
 	const char *uri_options;	/*!< URI options to add to the URI */
 	const char *vxml_url;		/*!< VXML url for Cisco phones */
@@ -596,20 +591,14 @@
 #define SIP_PROG_INBAND_NEVER	(0 << 24)
 #define SIP_PROG_INBAND_NO	(1 << 24)
 #define SIP_PROG_INBAND_YES	(2 << 24)
-/* Open Settlement Protocol authentication */
-#define SIP_OSPAUTH		(3 << 26)	/*!< four settings, uses two bits */
-#define SIP_OSPAUTH_NO		(0 << 26)
-#define SIP_OSPAUTH_GATEWAY	(1 << 26)
-#define SIP_OSPAUTH_PROXY	(2 << 26)
-#define SIP_OSPAUTH_EXCLUSIVE	(3 << 26)
-#define SIP_CALL_ONHOLD		(1 << 28)	/*!< Call states */
-#define SIP_CALL_LIMIT		(1 << 29)	/*!< Call limit enforced for this call */
-#define SIP_SENDRPID		(1 << 30)	/*!< Remote Party-ID Support */
-#define SIP_INC_COUNT		(1 << 31)	/*!< Did this connection increment the counter of in-use calls? */
+#define SIP_CALL_ONHOLD		(1 << 26)	/*!< Call states */
+#define SIP_CALL_LIMIT		(1 << 27)	/*!< Call limit enforced for this call */
+#define SIP_SENDRPID		(1 << 28)	/*!< Remote Party-ID Support */
+#define SIP_INC_COUNT		(1 << 29)	/*!< Did this connection increment the counter of in-use calls? */
 
 #define SIP_FLAGS_TO_COPY \
 	(SIP_PROMISCREDIR | SIP_TRUSTRPID | SIP_SENDRPID | SIP_DTMF | SIP_REINVITE | \
-	 SIP_PROG_INBAND | SIP_OSPAUTH | SIP_USECLIENTCODE | SIP_NAT | \
+	 SIP_PROG_INBAND | SIP_USECLIENTCODE | SIP_NAT | \
 	 SIP_USEREQPHONE | SIP_INSECURE_PORT | SIP_INSECURE_INVITE)
 
 /* a new page of flags for peers */
@@ -721,11 +710,6 @@
 	char lastmsg[256];			/*!< Last Message sent/received */
 	int amaflags;				/*!< AMA Flags */
 	int pendinginvite;			/*!< Any pending invite */
-#ifdef OSP_SUPPORT
-	int osphandle;				/*!< OSP Handle for call */
-	time_t ospstart;			/*!< OSP Start time */
-	unsigned int osptimelimit;		/*!< OSP call duration limit */
-#endif
 	struct sip_request initreq;		/*!< Initial request that opened the SIP dialog */
 	
 	int maxtime;				/*!< Max time for first response */
@@ -1537,7 +1521,8 @@
 	if (recordhistory) {
 		struct sip_request tmp;
 		parse_copy(&tmp, req);
-		append_history(p, reliable ? "TxRespRel" : "TxResp", "%s / %s", tmp.data, get_header(&tmp, "CSeq"));
+		append_history(p, reliable ? "TxRespRel" : "TxResp", "%s / %s - %s", tmp.data, get_header(&tmp, "CSeq"), 
+			tmp.method == SIP_RESPONSE ? tmp.rlPart2 : sip_methods[tmp.method].text);
 	}
 	res = (reliable) ?
 		__sip_reliable_xmit(p, seqno, 1, req->data, req->len, (reliable == XMIT_CRITICAL), req->method) :
@@ -1562,7 +1547,7 @@
 	if (recordhistory) {
 		struct sip_request tmp;
 		parse_copy(&tmp, req);
-		append_history(p, reliable ? "TxReqRel" : "TxReq", "%s / %s", tmp.data, get_header(&tmp, "CSeq"));
+		append_history(p, reliable ? "TxReqRel" : "TxReq", "%s / %s - %s", tmp.data, get_header(&tmp, "CSeq"), sip_methods[tmp.method].text);
 	}
 	res = (reliable) ?
 		__sip_reliable_xmit(p, seqno, 0, req->data, req->len, (reliable > 1), req->method) :
@@ -2066,9 +2051,6 @@
 {
 	int res;
 	struct sip_pvt *p;
-#ifdef OSP_SUPPORT
-	const char *osphandle = NULL;
-#endif	
 	struct varshead *headp;
 	struct ast_var_t *current;
 	
@@ -2093,30 +2075,12 @@
 			/* Check whether there is a variable with a name starting with SIPADDHEADER */
 			p->options->addsipheaders = 1;
 		}
-
-		
-#ifdef OSP_SUPPORT
-		else if (!p->options->osptoken && !strcasecmp(ast_var_name(current), "OSPTOKEN")) {
-			p->options->osptoken = ast_var_value(current);
-		} else if (!osphandle && !strcasecmp(ast_var_name(current), "OSPHANDLE")) {
-			osphandle = ast_var_value(current);
-		}
-#endif
 	}
 	
 	res = 0;
 	ast_set_flag(&p->flags[0], SIP_OUTGOING);
-#ifdef OSP_SUPPORT
-	if (!p->options->osptoken || !osphandle || (sscanf(osphandle, "%d", &p->osphandle) != 1)) {
-		/* Force Disable OSP support */
-		if (option_debug)
-			ast_log(LOG_DEBUG, "Disabling OSP support for this call. osptoken = %s, osphandle = %s\n", p->options->osptoken, osphandle);
-		p->options->osptoken = NULL;
-		osphandle = NULL;
-		p->osphandle = -1;
-	}
-#endif
-	ast_log(LOG_DEBUG, "Outgoing Call for %s\n", p->username);
+	if (option_debug)
+		ast_log(LOG_DEBUG, "Outgoing Call for %s\n", p->username);
 	res = update_call_counter(p, INC_CALL_LIMIT);
 	if ( res != -1 ) {
 		p->callingpres = ast->cid.cid_pres;
@@ -2530,11 +2494,6 @@
 		ast_log(LOG_DEBUG, "Hangup call %s, SIP callid %s)\n", ast->name, p->callid);
 
 	ast_mutex_lock(&p->lock);
-#ifdef OSP_SUPPORT
-	if ((p->osphandle > -1) && (ast->_state == AST_STATE_UP)) {
-		ast_osp_terminate(p->osphandle, AST_CAUSE_NORMAL, p->ospstart, time(NULL) - p->ospstart);
-	}
-#endif	
 	if (option_debug && sipdebug)
 		ast_log(LOG_DEBUG, "update_call_counter(%s) - decrement call limit counter on hangup\n", p->username);
 	update_call_counter(p, DEC_CALL_LIMIT);
@@ -2638,9 +2597,6 @@
 
 	ast_mutex_lock(&p->lock);

[... 2272 lines stripped ...]


More information about the asterisk-commits mailing list