[asterisk-commits] file: branch group/pimp_my_sip r379114 - /team/group/pimp_my_sip/channels/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Jan 15 10:36:16 CST 2013


Author: file
Date: Tue Jan 15 10:36:13 2013
New Revision: 379114

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=379114
Log:
Add the beginnings of a gulp_answer.

Modified:
    team/group/pimp_my_sip/channels/chan_gulp.c

Modified: team/group/pimp_my_sip/channels/chan_gulp.c
URL: http://svnview.digium.com/svn/asterisk/team/group/pimp_my_sip/channels/chan_gulp.c?view=diff&rev=379114&r1=379113&r2=379114
==============================================================================
--- team/group/pimp_my_sip/channels/chan_gulp.c (original)
+++ team/group/pimp_my_sip/channels/chan_gulp.c Tue Jan 15 10:36:13 2013
@@ -32,6 +32,12 @@
  ***/
 
 #include "asterisk.h"
+
+#undef bzero
+#define bzero bzero
+#include "pjsip.h"
+#include "pjsip_ua.h"
+#include "pjlib.h"
 
 ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
@@ -47,6 +53,8 @@
 #include "asterisk/app.h"
 #include "asterisk/musiconhold.h"
 #include "asterisk/causes.h"
+
+#include "asterisk/res_sip_session.h"
 
 static const char desc[] = "Gulp SIP Channel";
 static const char channel_type[] = "Gulp";
@@ -120,7 +128,19 @@
 /*! \brief Function called by core when we should answer a Gulp session */
 static int gulp_answer(struct ast_channel *ast)
 {
-	return -1;
+	struct ast_sip_session *session = ast_channel_tech_pvt(ast);
+	pj_status_t status;
+	pjsip_tx_data *packet;
+
+	if (ast_channel_state(ast) == AST_STATE_UP) {
+		return 0;
+	}
+
+	if ((status = pjsip_inv_answer(session->inv_session, 200, NULL, NULL, &packet)) == PJ_SUCCESS) {
+		pjsip_inv_send_msg(session->inv_session, packet);
+	}
+
+	return (status == PJ_SUCCESS) ? 0 : -1;
 }
 
 /*! \brief Function called by core to read any waiting frames */




More information about the asterisk-commits mailing list