[asterisk-commits] mmichelson: branch group/CCSS r237492 - in /team/group/CCSS: channels/ includ...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Jan 4 14:08:51 CST 2010


Author: mmichelson
Date: Mon Jan  4 14:08:48 2010
New Revision: 237492

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=237492
Log:
Add more logic into get_destination in chan_sip.

This makes it so that a CC recall will have the recall core ID returned
as an output parameter to handle_request_invite. After a channel gets
created for the INVITE, we can then call the proper functions to set up
datastores and set the CC_INTERFACES channel variable.

In addition, this commit also adds a missing '*' to the prototype for
ast_cc_agent_callback in ccss.h


Modified:
    team/group/CCSS/channels/chan_sip.c
    team/group/CCSS/include/asterisk/ccss.h

Modified: team/group/CCSS/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS/channels/chan_sip.c?view=diff&rev=237492&r1=237491&r2=237492
==============================================================================
--- team/group/CCSS/channels/chan_sip.c (original)
+++ team/group/CCSS/channels/chan_sip.c Mon Jan  4 14:08:48 2010
@@ -3214,7 +3214,7 @@
 static char *get_calleridname(const char *input, char *output, size_t outputsize);
 static int get_rpid(struct sip_pvt *p, struct sip_request *oreq);
 static int get_rdnis(struct sip_pvt *p, struct sip_request *oreq, char **name, char **number, int *reason);
-static int get_destination(struct sip_pvt *p, struct sip_request *oreq);
+static int get_destination(struct sip_pvt *p, struct sip_request *oreq, int *cc_recall_core_id);
 static int get_msg_text(char *buf, int len, struct sip_request *req, int addnewline);
 static int transmit_state_notify(struct sip_pvt *p, int state, int full, int timeout);
 static void update_connectedline(struct sip_pvt *p, const void *data, size_t datalen);
@@ -15327,7 +15327,7 @@
 	the dialplan, so that the outbound call also is a sips: call or encrypted
 	IAX2 call. If that's not available, the call should FAIL.
 */
-static int get_destination(struct sip_pvt *p, struct sip_request *oreq)
+static int get_destination(struct sip_pvt *p, struct sip_request *oreq, int *cc_recall_core_id)
 {
 	char tmp[256] = "", *uri, *a;
 	char tmpf[256] = "", *from = NULL;
@@ -15454,6 +15454,9 @@
 			 * his recall
 			 */
 			ast_cc_agent_recalling(agent->core_id, "SIP caller is attempting recall");
+			if (cc_recall_core_id) {
+				*cc_recall_core_id = agent->core_id;
+			}
 			return 0;
 		}
 	}
@@ -21560,7 +21563,7 @@
 		return 0;
 	}
 
-	res = get_destination(p, req);
+	res = get_destination(p, req, NULL);
 	build_contact(p);
 
 	if (ast_strlen_zero(p->context))
@@ -22398,6 +22401,7 @@
 		/* This is a new invite */
 		/* Handle authentication if this is our first invite */
 		struct ast_party_redirecting redirecting = {{0,},};
+		int cc_recall_core_id = -1;
 		set_pvt_allowed_methods(p, req);
 		res = check_user(p, req, SIP_INVITE, e, XMIT_RELIABLE, sin);
 		if (res == AUTH_CHALLENGE_SENT) {
@@ -22467,7 +22471,7 @@
 			}
 			return 0;
 		}
-		gotdest = get_destination(p, NULL);	/* Get destination right away */
+		gotdest = get_destination(p, NULL, &cc_recall_core_id);	/* Get destination right away */
 		change_redirecting_information(p, req, &redirecting, FALSE); /*Will return immediately if no Diversion header is present */
 		extract_uri(p, req);			/* Get the Contact URI */
 		build_contact(p);			/* Build our contact header */
@@ -22504,6 +22508,12 @@
 			make_our_tag(p->tag, sizeof(p->tag));
 			/* First invitation - create the channel */
 			c = sip_new(p, AST_STATE_DOWN, S_OR(p->peername, NULL), NULL);
+			if (cc_recall_core_id != -1) {
+				char full_extension[SIPBUFSIZE];
+				snprintf(full_extension, sizeof(full_extension) - 1, "%s@%s", p->exten, p->context);
+				ast_setup_cc_recall_datastore(c, cc_recall_core_id);
+				ast_set_cc_interfaces_chanvar(c, full_extension);
+			}
 			*recount = 1;
 
 			/* Save Record-Route for any later requests we make on this dialogue */
@@ -24262,7 +24272,7 @@
 
 	if (strcmp(event, "message-summary") && strcmp(event, "call-completion")) {
 		/* Get destination right away */
-		gotdest = get_destination(p, NULL);
+		gotdest = get_destination(p, NULL, NULL);
 	}
 
 	/* Get full contact header - this needs to be used as a request URI in NOTIFY's */

Modified: team/group/CCSS/include/asterisk/ccss.h
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS/include/asterisk/ccss.h?view=diff&rev=237492&r1=237491&r2=237492
==============================================================================
--- team/group/CCSS/include/asterisk/ccss.h (original)
+++ team/group/CCSS/include/asterisk/ccss.h Mon Jan  4 14:08:48 2010
@@ -911,7 +911,7 @@
  * \param arg the argument to the callback function
  * \param type The type of agents to call the callback on
  */
-struct ast_cc_agent *ast_cc_agent_callback(int flags, ao2_callback_fn function, void *arg, const char * const type);
+struct ast_cc_agent *ast_cc_agent_callback(int flags, ao2_callback_fn *function, void *arg, const char * const type);
 
 /* END STRUCTURES FOR AGENTS */
 




More information about the asterisk-commits mailing list