[asterisk-commits] file: branch group/pimp_my_sip r379937 - in /team/group/pimp_my_sip: channels...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Jan 22 15:10:27 CST 2013
Author: file
Date: Tue Jan 22 15:10:23 2013
New Revision: 379937
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=379937
Log:
Check for thread registration in more places, don't assume a channel still exists when the session is ended, only call incoming_response on the method specified by the supplement, and apply the remote SDP after SDP negotiation has finished.
Modified:
team/group/pimp_my_sip/channels/chan_gulp.c
team/group/pimp_my_sip/res/res_sip_session.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=379937&r1=379936&r2=379937
==============================================================================
--- team/group/pimp_my_sip/channels/chan_gulp.c (original)
+++ team/group/pimp_my_sip/channels/chan_gulp.c Tue Jan 22 15:10:23 2013
@@ -390,6 +390,8 @@
{
struct ast_sip_session *session = ast_channel_tech_pvt(ast);
pjsip_tx_data *packet;
+
+ pj_thread_register_check();
if (pjsip_inv_invite(session->inv_session, &packet) != PJ_SUCCESS) {
return -1;
@@ -487,6 +489,8 @@
ast_string_field_set(endpoint, context, "default");
ast_parse_allow_disallow(&endpoint->prefs, endpoint->codecs, "ulaw", 1);
+ pj_thread_register_check();
+
if (!(session = ast_sip_session_create_outgoing(endpoint, data))) {
return NULL;
}
@@ -599,9 +603,11 @@
/*! \brief Function called when the session ends */
static void gulp_session_end(struct ast_sip_session *session)
{
- int cause = hangup_sip2cause(session->inv_session->cause);
-
- ast_queue_hangup_with_cause(session->channel, cause);
+ if (session->channel) {
+ int cause = hangup_sip2cause(session->inv_session->cause);
+
+ ast_queue_hangup_with_cause(session->channel, cause);
+ }
}
/*! \brief Function called when a request is received on the session */
Modified: team/group/pimp_my_sip/res/res_sip_session.c
URL: http://svnview.digium.com/svn/asterisk/team/group/pimp_my_sip/res/res_sip_session.c?view=diff&rev=379937&r1=379936&r2=379937
==============================================================================
--- team/group/pimp_my_sip/res/res_sip_session.c (original)
+++ team/group/pimp_my_sip/res/res_sip_session.c Tue Jan 22 15:10:23 2013
@@ -750,16 +750,18 @@
{
struct ast_sip_session_supplement *supplement;
struct pjsip_status_line status = rdata->msg_info.msg->line.status;
+ char method[16];
+ pj_str_t *pj_method = &rdata->msg_info.cseq->method.name;
+
+ /* TODO: Is using the method from the CSeq good enough? */
+ ast_copy_pj_str(method, pj_method, sizeof(method));
ast_debug(3, "Response is %d %.*s\n", status.code, (int) pj_strlen(&status.reason),
pj_strbuf(&status.reason));
AST_LIST_TRAVERSE(&session->supplements, supplement, next) {
- /* XXX Not sure how to get the method from a response.
- * For now, just call supplements on all responses, no
- * matter the method. This is less than ideal
- */
- if (supplement->incoming_response) {
+ if (supplement->incoming_response && (
+ !supplement->method || !strcmp(supplement->method, method))) {
supplement->incoming_response(session, rdata);
}
}
@@ -964,9 +966,15 @@
}
#endif
-static void session_inv_on_media_update(pjsip_inv_session *inv_ses, pj_status_t status)
-{
- /* XXX STUB */
+static void session_inv_on_media_update(pjsip_inv_session *inv, pj_status_t status)
+{
+ struct ast_sip_session *session = inv->mod_data[session_module.id];
+ const pjmedia_sdp_session *remote;
+
+ /* TODO: Split up handling of incoming and actual applying */
+ if (pjmedia_sdp_neg_get_active_remote(inv->neg, &remote) == PJ_SUCCESS) {
+ handle_incoming_sdp(session, remote);
+ }
}
static pjsip_redirect_op session_inv_on_redirected(pjsip_inv_session *inv, const pjsip_uri *target, const pjsip_event *e)
More information about the asterisk-commits
mailing list