Author: dlee
Date: Wed Jul 31 15:37:07 2013
New Revision: 395903

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=395903
Log:
Merged revisions 395810-395884 from http://svn.asterisk.org/svn/asterisk/trunk

Removed:
    team/dlee/ari-async-bridge/res/res_pjsip_endpoint_identifier_constant.c
Modified:
    team/dlee/ari-async-bridge/   (props changed)
    team/dlee/ari-async-bridge/bridges/bridge_native_rtp.c
    team/dlee/ari-async-bridge/channels/chan_pjsip.c
    team/dlee/ari-async-bridge/configs/pjsip.conf.sample
    team/dlee/ari-async-bridge/include/asterisk/res_pjsip.h
    team/dlee/ari-async-bridge/include/asterisk/res_pjsip_exten_state.h
    team/dlee/ari-async-bridge/include/asterisk/res_pjsip_pubsub.h
    team/dlee/ari-async-bridge/include/asterisk/res_pjsip_session.h
    team/dlee/ari-async-bridge/main/abstract_jb.c
    team/dlee/ari-async-bridge/res/res_pjsip/include/res_pjsip_private.h
    team/dlee/ari-async-bridge/res/res_pjsip/pjsip_options.c
    team/dlee/ari-async-bridge/res/res_pjsip_endpoint_identifier_ip.c
    team/dlee/ari-async-bridge/tests/test_cel.c

Propchange: team/dlee/ari-async-bridge/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Wed Jul 31 15:37:07 2013
@@ -1,1 +1,1 @@
-/trunk:1-395794
+/trunk:1-395902

Modified: team/dlee/ari-async-bridge/bridges/bridge_native_rtp.c
URL: 
http://svnview.digium.com/svn/asterisk/team/dlee/ari-async-bridge/bridges/bridge_native_rtp.c?view=diff&rev=395903&r1=395902&r2=395903
==============================================================================
--- team/dlee/ari-async-bridge/bridges/bridge_native_rtp.c (original)
+++ team/dlee/ari-async-bridge/bridges/bridge_native_rtp.c Wed Jul 31 15:37:07 
2013
@@ -46,46 +46,11 @@
 #include "asterisk/frame.h"
 #include "asterisk/rtp_engine.h"
 
-/*! \brief Forward declarations for frame hook usage */
-static int native_rtp_bridge_join(struct ast_bridge *bridge, struct 
ast_bridge_channel *bridge_channel);
-static void native_rtp_bridge_leave(struct ast_bridge *bridge, struct 
ast_bridge_channel *bridge_channel);
-
 /*! \brief Internal structure which contains information about bridged RTP 
channels */
 struct native_rtp_bridge_data {
        /*! \brief Framehook used to intercept certain control frames */
        int id;
 };
-
-/*! \brief Frame hook that is called to intercept hold/unhold */
-static struct ast_frame *native_rtp_framehook(struct ast_channel *chan, struct 
ast_frame *f, enum ast_framehook_event event, void *data)
-{
-       RAII_VAR(struct ast_bridge *, bridge, NULL, ao2_cleanup);
-
-       if (!f || (event != AST_FRAMEHOOK_EVENT_WRITE)) {
-               return f;
-       }
-
-       ast_channel_lock(chan);
-       bridge = ast_channel_get_bridge(chan);
-       ast_channel_unlock(chan);
-
-       /* It's safe for NULL to be passed to both of these, bridge_channel 
isn't used at all */
-       if (bridge) {
-               if (f->subclass.integer == AST_CONTROL_HOLD) {
-                       
native_rtp_bridge_leave(ast_channel_internal_bridge(chan), NULL);
-               } else if ((f->subclass.integer == AST_CONTROL_UNHOLD) || 
(f->subclass.integer == AST_CONTROL_UPDATE_RTP_PEER)) {
-                       
native_rtp_bridge_join(ast_channel_internal_bridge(chan), NULL);
-               }
-       }
-
-       return f;
-}
-
-/*! \brief Internal helper function which checks whether the channels are 
compatible with our native bridging */
-static int native_rtp_bridge_capable(struct ast_channel *chan)
-{
-       return !ast_channel_has_audio_frame_or_monitor(chan);
-}
 
 /*! \brief Internal helper function which gets all RTP information (glue and 
instances) relating to the given channels */
 static enum ast_rtp_glue_result native_rtp_bridge_get(struct ast_channel *c0, 
struct ast_channel *c1, struct ast_rtp_glue **glue0,
@@ -140,6 +105,130 @@
        }
 
        return audio_glue0_res;
+}
+
+/*! \brief Start RTP native bridging */
+static int native_rtp_bridge_start(struct ast_bridge *bridge)
+{
+       struct ast_bridge_channel *c0 = AST_LIST_FIRST(&bridge->channels);
+       struct ast_bridge_channel *c1 = AST_LIST_LAST(&bridge->channels);
+       enum ast_rtp_glue_result native_type;
+       struct ast_rtp_glue *glue0, *glue1;
+       struct ast_rtp_instance *instance0 = NULL, *instance1 = NULL, 
*vinstance0 = NULL;
+       struct ast_rtp_instance *vinstance1 = NULL, *tinstance0 = NULL, 
*tinstance1 = NULL;
+       RAII_VAR(struct ast_format_cap *, cap0, ast_format_cap_alloc_nolock(), 
ast_format_cap_destroy);
+       RAII_VAR(struct ast_format_cap *, cap1, ast_format_cap_alloc_nolock(), 
ast_format_cap_destroy);
+
+       if (c0 == c1) {
+               return 0;
+       }
+
+       native_type = native_rtp_bridge_get(c0->chan, c1->chan, &glue0, &glue1, 
&instance0, &instance1, &vinstance0, &vinstance1);
+
+       if (glue0->get_codec) {
+               glue0->get_codec(c0->chan, cap0);
+       }
+       if (glue1->get_codec) {
+               glue1->get_codec(c1->chan, cap1);
+       }
+
+       switch (native_type) {
+       case AST_RTP_GLUE_RESULT_LOCAL:
+               if (ast_rtp_instance_get_engine(instance0)->local_bridge) {
+                       
ast_rtp_instance_get_engine(instance0)->local_bridge(instance0, instance1);
+               }
+               if (ast_rtp_instance_get_engine(instance1)->local_bridge) {
+                       
ast_rtp_instance_get_engine(instance1)->local_bridge(instance1, instance0);
+               }
+               ast_rtp_instance_set_bridged(instance0, instance1);
+               ast_rtp_instance_set_bridged(instance1, instance0);
+               ast_debug(2, "Locally RTP bridged '%s' and '%s' in stack\n",
+                       ast_channel_name(c0->chan), ast_channel_name(c1->chan));
+               break;
+
+       case AST_RTP_GLUE_RESULT_REMOTE:
+               glue0->update_peer(c0->chan, instance1, vinstance1, tinstance1, 
cap1, 0);
+               glue1->update_peer(c1->chan, instance0, vinstance0, tinstance0, 
cap0, 0);
+               ast_debug(2, "Remotely bridged '%s' and '%s' - media will flow 
directly between them\n",
+                       ast_channel_name(c0->chan), ast_channel_name(c1->chan));
+               break;
+       case AST_RTP_GLUE_RESULT_FORBID:
+               break;
+       }
+
+       return 0;
+}
+
+/*! \brief Stop RTP native bridging */
+static void native_rtp_bridge_stop(struct ast_bridge *bridge)
+{
+       struct ast_bridge_channel *c0 = AST_LIST_FIRST(&bridge->channels);
+       struct ast_bridge_channel *c1 = AST_LIST_LAST(&bridge->channels);
+       enum ast_rtp_glue_result native_type;
+       struct ast_rtp_glue *glue0, *glue1 = NULL;
+       struct ast_rtp_instance *instance0 = NULL, *instance1 = NULL, 
*vinstance0 = NULL, *vinstance1 = NULL;
+
+       if (c0 == c1) {
+               return;
+       }
+
+       native_type = native_rtp_bridge_get(c0->chan, c1 ? c1->chan : NULL, 
&glue0, &glue1, &instance0, &instance1, &vinstance0, &vinstance1);
+
+       switch (native_type) {
+       case AST_RTP_GLUE_RESULT_LOCAL:
+               if (ast_rtp_instance_get_engine(instance0)->local_bridge) {
+                       
ast_rtp_instance_get_engine(instance0)->local_bridge(instance0, NULL);
+               }
+               if (instance1 && 
ast_rtp_instance_get_engine(instance1)->local_bridge) {
+                       
ast_rtp_instance_get_engine(instance1)->local_bridge(instance1, NULL);
+               }
+               ast_rtp_instance_set_bridged(instance0, NULL);
+               if (instance1) {
+                       ast_rtp_instance_set_bridged(instance1, NULL);
+               }
+               break;
+       case AST_RTP_GLUE_RESULT_REMOTE:
+               glue0->update_peer(c0->chan, NULL, NULL, NULL, NULL, 0);
+               if (glue1) {
+                       glue1->update_peer(c1->chan, NULL, NULL, NULL, NULL, 0);
+               }
+               break;
+       case AST_RTP_GLUE_RESULT_FORBID:
+               break;
+       }
+
+       ast_debug(2, "Discontinued RTP bridging of '%s' and '%s' - media will 
flow through Asterisk core\n",
+               ast_channel_name(c0->chan), ast_channel_name(c1->chan));
+}
+
+/*! \brief Frame hook that is called to intercept hold/unhold */
+static struct ast_frame *native_rtp_framehook(struct ast_channel *chan, struct 
ast_frame *f, enum ast_framehook_event event, void *data)
+{
+       RAII_VAR(struct ast_bridge *, bridge, NULL, ao2_cleanup);
+
+       if (!f || (event != AST_FRAMEHOOK_EVENT_WRITE)) {
+               return f;
+       }
+
+       ast_channel_lock(chan);
+       bridge = ast_channel_get_bridge(chan);
+       ast_channel_unlock(chan);
+
+       if (bridge) {
+               if (f->subclass.integer == AST_CONTROL_HOLD) {
+                       native_rtp_bridge_stop(bridge);
+               } else if ((f->subclass.integer == AST_CONTROL_UNHOLD) || 
(f->subclass.integer == AST_CONTROL_UPDATE_RTP_PEER)) {
+                       native_rtp_bridge_start(bridge);
+               }
+       }
+
+       return f;
+}
+
+/*! \brief Internal helper function which checks whether the channels are 
compatible with our native bridging */
+static int native_rtp_bridge_capable(struct ast_channel *chan)
+{
+       return !ast_channel_has_audio_frame_or_monitor(chan);
 }
 
 static int native_rtp_bridge_compatible(struct ast_bridge *bridge)
@@ -254,15 +343,7 @@
                return -1;
        }
 
-/*
- * BUGBUG The RTP native bridge technology should use tech_pvt not bridge_pvt.
- *
- * This technology needs to be reworked to not change the
- * tech_pvt of channels other than the one that is currently
- * entering/leaving before it can actually use the correct
- * pointer.
- */
-       bridge_channel->bridge_pvt = data;
+       bridge_channel->tech_pvt = data;
 
        return 0;
 }
@@ -270,7 +351,7 @@
 /*! \brief Helper function which removes frame hook from bridge channel */
 static void native_rtp_bridge_framehook_detach(struct ast_bridge_channel 
*bridge_channel)
 {
-       RAII_VAR(struct native_rtp_bridge_data *, data, 
bridge_channel->bridge_pvt, ao2_cleanup);
+       RAII_VAR(struct native_rtp_bridge_data *, data, 
bridge_channel->tech_pvt, ao2_cleanup);
 
        if (!data) {
                return;
@@ -279,65 +360,17 @@
        ast_channel_lock(bridge_channel->chan);
        ast_framehook_detach(bridge_channel->chan, data->id);
        ast_channel_unlock(bridge_channel->chan);
-       bridge_channel->bridge_pvt = NULL;
+       bridge_channel->tech_pvt = NULL;
 }
 
 static int native_rtp_bridge_join(struct ast_bridge *bridge, struct 
ast_bridge_channel *bridge_channel)
 {
-       struct ast_bridge_channel *c0 = AST_LIST_FIRST(&bridge->channels);
-       struct ast_bridge_channel *c1 = AST_LIST_LAST(&bridge->channels);
-       enum ast_rtp_glue_result native_type;
-       struct ast_rtp_glue *glue0, *glue1;
-       struct ast_rtp_instance *instance0 = NULL, *instance1 = NULL, 
*vinstance0 = NULL;
-       struct ast_rtp_instance *vinstance1 = NULL, *tinstance0 = NULL, 
*tinstance1 = NULL;
-       RAII_VAR(struct ast_format_cap *, cap0, ast_format_cap_alloc_nolock(), 
ast_format_cap_destroy);
-       RAII_VAR(struct ast_format_cap *, cap1, ast_format_cap_alloc_nolock(), 
ast_format_cap_destroy);
-
-       native_rtp_bridge_framehook_detach(c0);
-       if (native_rtp_bridge_framehook_attach(c0)) {
+       native_rtp_bridge_framehook_detach(bridge_channel);
+       if (native_rtp_bridge_framehook_attach(bridge_channel)) {
                return -1;
        }
 
-       native_rtp_bridge_framehook_detach(c1);
-       if (native_rtp_bridge_framehook_attach(c1)) {
-               native_rtp_bridge_framehook_detach(c0);
-               return -1;
-       }
-
-       native_type = native_rtp_bridge_get(c0->chan, c1->chan, &glue0, &glue1, 
&instance0, &instance1, &vinstance0, &vinstance1);
-
-       if (glue0->get_codec) {
-               glue0->get_codec(c0->chan, cap0);
-       }
-       if (glue1->get_codec) {
-               glue1->get_codec(c1->chan, cap1);
-       }
-
-       switch (native_type) {
-       case AST_RTP_GLUE_RESULT_LOCAL:
-               if (ast_rtp_instance_get_engine(instance0)->local_bridge) {
-                       
ast_rtp_instance_get_engine(instance0)->local_bridge(instance0, instance1);
-               }
-               if (ast_rtp_instance_get_engine(instance1)->local_bridge) {
-                       
ast_rtp_instance_get_engine(instance1)->local_bridge(instance1, instance0);
-               }
-               ast_rtp_instance_set_bridged(instance0, instance1);
-               ast_rtp_instance_set_bridged(instance1, instance0);
-               ast_debug(2, "Locally RTP bridged '%s' and '%s' in stack\n",
-                       ast_channel_name(c0->chan), ast_channel_name(c1->chan));
-               break;
-
-       case AST_RTP_GLUE_RESULT_REMOTE:
-               glue0->update_peer(c0->chan, instance1, vinstance1, tinstance1, 
cap1, 0);
-               glue1->update_peer(c1->chan, instance0, vinstance0, tinstance0, 
cap0, 0);
-               ast_debug(2, "Remotely bridged '%s' and '%s' - media will flow 
directly between them\n",
-                       ast_channel_name(c0->chan), ast_channel_name(c1->chan));
-               break;
-       case AST_RTP_GLUE_RESULT_FORBID:
-               break;
-       }
-
-       return 0;
+       return native_rtp_bridge_start(bridge);
 }
 
 static void native_rtp_bridge_unsuspend(struct ast_bridge *bridge, struct 
ast_bridge_channel *bridge_channel)
@@ -347,44 +380,9 @@
 
 static void native_rtp_bridge_leave(struct ast_bridge *bridge, struct 
ast_bridge_channel *bridge_channel)
 {
-       struct ast_bridge_channel *c0 = AST_LIST_FIRST(&bridge->channels) ? 
AST_LIST_FIRST(&bridge->channels) : bridge_channel;
-       struct ast_bridge_channel *c1 = AST_LIST_LAST(&bridge->channels);
-       enum ast_rtp_glue_result native_type;
-       struct ast_rtp_glue *glue0, *glue1 = NULL;
-       struct ast_rtp_instance *instance0 = NULL, *instance1 = NULL, 
*vinstance0 = NULL, *vinstance1 = NULL;
-
-       native_rtp_bridge_framehook_detach(c0);
-       if (c1) {
-               native_rtp_bridge_framehook_detach(c1);
-       }
-
-       native_type = native_rtp_bridge_get(c0->chan, c1 ? c1->chan : NULL, 
&glue0, &glue1, &instance0, &instance1, &vinstance0, &vinstance1);
-
-       switch (native_type) {
-       case AST_RTP_GLUE_RESULT_LOCAL:
-               if (ast_rtp_instance_get_engine(instance0)->local_bridge) {
-                       
ast_rtp_instance_get_engine(instance0)->local_bridge(instance0, NULL);
-               }
-               if (instance1 && 
ast_rtp_instance_get_engine(instance1)->local_bridge) {
-                       
ast_rtp_instance_get_engine(instance1)->local_bridge(instance1, NULL);
-               }
-               ast_rtp_instance_set_bridged(instance0, instance1);
-               if (instance1) {
-                       ast_rtp_instance_set_bridged(instance1, instance0);
-               }
-               break;
-       case AST_RTP_GLUE_RESULT_REMOTE:
-               glue0->update_peer(c0->chan, NULL, NULL, NULL, NULL, 0);
-               if (glue1) {
-                       glue1->update_peer(c1->chan, NULL, NULL, NULL, NULL, 0);
-               }
-               break;
-       case AST_RTP_GLUE_RESULT_FORBID:
-               break;
-       }
-
-       ast_debug(2, "Discontinued RTP bridging of '%s' and '%s' - media will 
flow through Asterisk core\n",
-               ast_channel_name(c0->chan), ast_channel_name(c1->chan));
+       native_rtp_bridge_framehook_detach(bridge_channel);
+
+       native_rtp_bridge_stop(bridge);
 }
 
 static int native_rtp_bridge_write(struct ast_bridge *bridge, struct 
ast_bridge_channel *bridge_channel, struct ast_frame *frame)

Modified: team/dlee/ari-async-bridge/channels/chan_pjsip.c
URL: 
http://svnview.digium.com/svn/asterisk/team/dlee/ari-async-bridge/channels/chan_pjsip.c?view=diff&rev=395903&r1=395902&r2=395903
==============================================================================
--- team/dlee/ari-async-bridge/channels/chan_pjsip.c (original)
+++ team/dlee/ari-async-bridge/channels/chan_pjsip.c Wed Jul 31 15:37:07 2013
@@ -577,7 +577,7 @@
                return NULL;
        }
 
-       /* If res_sip_session is ever updated to create/destroy 
ast_sip_session_media
+       /* If res_pjsip_session is ever updated to create/destroy 
ast_sip_session_media
         * during a call such as if multiple same-type stream support is 
introduced,
         * these will need to be recaptured as well */
        pvt->media[SIP_MEDIA_AUDIO] = ao2_find(session->media, "audio", 
OBJ_KEY);

Modified: team/dlee/ari-async-bridge/configs/pjsip.conf.sample
URL: 
http://svnview.digium.com/svn/asterisk/team/dlee/ari-async-bridge/configs/pjsip.conf.sample?view=diff&rev=395903&r1=395902&r2=395903
==============================================================================
--- team/dlee/ari-async-bridge/configs/pjsip.conf.sample (original)
+++ team/dlee/ari-async-bridge/configs/pjsip.conf.sample Wed Jul 31 15:37:07 
2013
@@ -1,4 +1,4 @@
-; This is an in-flux configuration file for the res_sip module, it will change 
as things progress
+; This is an in-flux configuration file for the res_pjsip module, it will 
change as things progress
 
 ;;; Transports
 ;[local]

Modified: team/dlee/ari-async-bridge/include/asterisk/res_pjsip.h
URL: 
http://svnview.digium.com/svn/asterisk/team/dlee/ari-async-bridge/include/asterisk/res_pjsip.h?view=diff&rev=395903&r1=395902&r2=395903
==============================================================================
--- team/dlee/ari-async-bridge/include/asterisk/res_pjsip.h (original)
+++ team/dlee/ari-async-bridge/include/asterisk/res_pjsip.h Wed Jul 31 15:37:07 
2013
@@ -16,8 +16,8 @@
  * at the top of the source tree.
  */
 
-#ifndef _RES_SIP_H
-#define _RES_SIP_H
+#ifndef _RES_PJSIP_H
+#define _RES_PJSIP_H
 
 #include "asterisk/stringfields.h"
 /* Needed for struct ast_sockaddr */
@@ -1499,4 +1499,4 @@
 
 int ast_sip_initialize_sorcery_global(struct ast_sorcery *sorcery);
 
-#endif /* _RES_SIP_H */
+#endif /* _RES_PJSIP_H */

Modified: team/dlee/ari-async-bridge/include/asterisk/res_pjsip_exten_state.h
URL: 
http://svnview.digium.com/svn/asterisk/team/dlee/ari-async-bridge/include/asterisk/res_pjsip_exten_state.h?view=diff&rev=395903&r1=395902&r2=395903
==============================================================================
--- team/dlee/ari-async-bridge/include/asterisk/res_pjsip_exten_state.h 
(original)
+++ team/dlee/ari-async-bridge/include/asterisk/res_pjsip_exten_state.h Wed Jul 
31 15:37:07 2013
@@ -16,8 +16,8 @@
  * at the top of the source tree.
  */
 
-#ifndef _RES_SIP_EXTEN_STATE_H
-#define _RES_SIP_EXTEN_STATE_H
+#ifndef _RES_PJSIP_EXTEN_STATE_H
+#define _RES_PJSIP_EXTEN_STATE_H
 
 #include "asterisk/stringfields.h"
 #include "asterisk/linkedlists.h"
@@ -91,4 +91,4 @@
  */
 void ast_sip_unregister_exten_state_provider(struct 
ast_sip_exten_state_provider *obj);
 
-#endif
+#endif /* _RES_PJSIP_EXTEN_STATE_H */

Modified: team/dlee/ari-async-bridge/include/asterisk/res_pjsip_pubsub.h
URL: 
http://svnview.digium.com/svn/asterisk/team/dlee/ari-async-bridge/include/asterisk/res_pjsip_pubsub.h?view=diff&rev=395903&r1=395902&r2=395903
==============================================================================
--- team/dlee/ari-async-bridge/include/asterisk/res_pjsip_pubsub.h (original)
+++ team/dlee/ari-async-bridge/include/asterisk/res_pjsip_pubsub.h Wed Jul 31 
15:37:07 2013
@@ -16,8 +16,8 @@
  * at the top of the source tree.
  */
 
-#ifndef _RES_SIP_PUBSUB_H
-#define _RES_SIP_PUBSUB_H
+#ifndef _RES_PJSIP_PUBSUB_H
+#define _RES_PJSIP_PUBSUB_H
 
 #include "asterisk/linkedlists.h"
 
@@ -513,4 +513,4 @@
  */
 void ast_sip_unregister_subscription_handler(struct 
ast_sip_subscription_handler *handler);
 
-#endif /* RES_SIP_PUBSUB_H */
+#endif /* RES_PJSIP_PUBSUB_H */

Modified: team/dlee/ari-async-bridge/include/asterisk/res_pjsip_session.h
URL: 
http://svnview.digium.com/svn/asterisk/team/dlee/ari-async-bridge/include/asterisk/res_pjsip_session.h?view=diff&rev=395903&r1=395902&r2=395903
==============================================================================
--- team/dlee/ari-async-bridge/include/asterisk/res_pjsip_session.h (original)
+++ team/dlee/ari-async-bridge/include/asterisk/res_pjsip_session.h Wed Jul 31 
15:37:07 2013
@@ -16,8 +16,8 @@
  * at the top of the source tree.
  */
 
-#ifndef _RES_SIP_SESSION_H
-#define _RES_SIP_SESSION_H
+#ifndef _RES_PJSIP_SESSION_H
+#define _RES_PJSIP_SESSION_H
 
 /* Needed for pj_timer_entry definition */
 #include "pjlib.h"
@@ -141,7 +141,7 @@
        /*! Top priority. Supplements with this priority are those that need to 
run before any others */
        AST_SIP_SESSION_SUPPLEMENT_PRIORITY_FIRST = 0,
        /*! Channel creation priority.
-        * chan_gulp creates a channel at this priority. If your supplement 
depends on being run before
+        * chan_pjsip creates a channel at this priority. If your supplement 
depends on being run before
         * or after channel creation, then set your priority to be lower or 
higher than this value.
         */
        AST_SIP_SESSION_SUPPLEMENT_PRIORITY_CHANNEL = 1000000,
@@ -466,7 +466,7 @@
  * \brief Send a reinvite or UPDATE on a session
  *
  * This method will inspect the session in order to construct an appropriate
- * session refresh request. As with any outgoing request in res_sip_session,
+ * session refresh request. As with any outgoing request in res_pjsip_session,
  * this will call into registered supplements in case they wish to add 
anything.
  *
  * Note: The on_request_creation callback may or may not be called in the same
@@ -558,4 +558,4 @@
  */
 void ast_sip_session_resume_reinvite(struct ast_sip_session *session);
 
-#endif /* _RES_SIP_SESSION_H */
+#endif /* _RES_PJSIP_SESSION_H */

Modified: team/dlee/ari-async-bridge/main/abstract_jb.c
URL: 
http://svnview.digium.com/svn/asterisk/team/dlee/ari-async-bridge/main/abstract_jb.c?view=diff&rev=395903&r1=395902&r2=395903
==============================================================================
--- team/dlee/ari-async-bridge/main/abstract_jb.c (original)
+++ team/dlee/ari-async-bridge/main/abstract_jb.c Wed Jul 31 15:37:07 2013
@@ -409,7 +409,6 @@
        struct ast_jb_conf *jbconf = &jb->conf;
        const struct ast_jb_impl *jbimpl = jb->impl;
        void *jbobj;
-       struct ast_channel *bridged;
        long now;
        char logfile_pathname[20 + AST_JB_IMPL_NAME_SIZE + 2*AST_CHANNEL_NAME + 
1];
        char name1[AST_CHANNEL_NAME], name2[AST_CHANNEL_NAME], *tmp;
@@ -442,14 +441,15 @@
 
        /* Create a frame log file */
        if (ast_test_flag(jbconf, AST_JB_LOG)) {
+               RAII_VAR(struct ast_channel *, bridged, 
ast_channel_bridge_peer(chan), ast_channel_cleanup);
                char safe_logfile[30] = "/tmp/logfile-XXXXXX";
                int safe_fd;
+
                snprintf(name2, sizeof(name2), "%s", ast_channel_name(chan));
                if ((tmp = strchr(name2, '/'))) {
                        *tmp = '#';
                }
 
-               bridged = ast_bridged_channel(chan);
                /* We should always have bridged chan if a jitterbuffer is in 
use */
                ast_assert(bridged != NULL);
 

Modified: team/dlee/ari-async-bridge/res/res_pjsip/include/res_pjsip_private.h
URL: 
http://svnview.digium.com/svn/asterisk/team/dlee/ari-async-bridge/res/res_pjsip/include/res_pjsip_private.h?view=diff&rev=395903&r1=395902&r2=395903
==============================================================================
--- team/dlee/ari-async-bridge/res/res_pjsip/include/res_pjsip_private.h 
(original)
+++ team/dlee/ari-async-bridge/res/res_pjsip/include/res_pjsip_private.h Wed 
Jul 31 15:37:07 2013
@@ -5,8 +5,8 @@
  *      Author: mjordan
  */
 
-#ifndef RES_SIP_PRIVATE_H_
-#define RES_SIP_PRIVATE_H_
+#ifndef RES_PJSIP_PRIVATE_H_
+#define RES_PJSIP_PRIVATE_H_
 
 struct ao2_container;
 
@@ -71,4 +71,4 @@
  */
 int ast_sip_initialize_global(void);
 
-#endif /* RES_SIP_PRIVATE_H_ */
+#endif /* RES_PJSIP_PRIVATE_H_ */

Modified: team/dlee/ari-async-bridge/res/res_pjsip/pjsip_options.c
URL: 
http://svnview.digium.com/svn/asterisk/team/dlee/ari-async-bridge/res/res_pjsip/pjsip_options.c?view=diff&rev=395903&r1=395902&r2=395903
==============================================================================
--- team/dlee/ari-async-bridge/res/res_pjsip/pjsip_options.c (original)
+++ team/dlee/ari-async-bridge/res/res_pjsip/pjsip_options.c Wed Jul 31 
15:37:07 2013
@@ -625,9 +625,9 @@
 
        switch (cmd) {
        case CLI_INIT:
-               e->command = "sip qualify";
+               e->command = "pjsip qualify";
                e->usage =
-                       "Usage: sip qualify <endpoint>\n"
+                       "Usage: pjsip qualify <endpoint>\n"
                        "       Send a SIP OPTIONS request to all contacts on 
the endpoint.\n";
                return NULL;
        case CLI_GENERATE:
@@ -653,7 +653,7 @@
 }
 
 static struct ast_cli_entry cli_options[] = {
-       AST_CLI_DEFINE(cli_qualify, "Send an OPTIONS request to a SIP endpoint")
+       AST_CLI_DEFINE(cli_qualify, "Send an OPTIONS request to a PJSIP 
endpoint")
 };
 
 static int sched_qualifies_hash_fn(const void *obj, int flags)

Modified: team/dlee/ari-async-bridge/res/res_pjsip_endpoint_identifier_ip.c
URL: 
http://svnview.digium.com/svn/asterisk/team/dlee/ari-async-bridge/res/res_pjsip_endpoint_identifier_ip.c?view=diff&rev=395903&r1=395902&r2=395903
==============================================================================
--- team/dlee/ari-async-bridge/res/res_pjsip_endpoint_identifier_ip.c (original)
+++ team/dlee/ari-async-bridge/res/res_pjsip_endpoint_identifier_ip.c Wed Jul 
31 15:37:07 2013
@@ -33,7 +33,7 @@
 /*** DOCUMENTATION
        <configInfo name="res_pjsip_endpoint_identifier_ip" language="en_US">
                <synopsis>Module that identifies endpoints via source IP 
address</synopsis>
-               <configFile name="res_pjsip.conf">
+               <configFile name="pjsip.conf">
                        <configObject name="identify">
                                <configOption name="endpoint">
                                        <synopsis>Name of Endpoint</synopsis>
@@ -135,7 +135,7 @@
 
 static int load_module(void)
 {
-       ast_sorcery_apply_default(ast_sip_get_sorcery(), "identify", "config", 
"res_pjsip.conf,criteria=type=identify");
+       ast_sorcery_apply_default(ast_sip_get_sorcery(), "identify", "config", 
"pjsip.conf,criteria=type=identify");
 
        if (ast_sorcery_object_register(ast_sip_get_sorcery(), "identify", 
ip_identify_alloc, NULL, NULL)) {
                return AST_MODULE_LOAD_DECLINE;

Modified: team/dlee/ari-async-bridge/tests/test_cel.c
URL: 
http://svnview.digium.com/svn/asterisk/team/dlee/ari-async-bridge/tests/test_cel.c?view=diff&rev=395903&r1=395902&r2=395903
==============================================================================
--- team/dlee/ari-async-bridge/tests/test_cel.c (original)
+++ team/dlee/ari-async-bridge/tests/test_cel.c Wed Jul 31 15:37:07 2013
@@ -61,6 +61,18 @@
 /*! \brief The CEL config used for CEL unit tests */
 static struct ast_cel_general_config *cel_test_config;
 
+/*! \brief Lock used for synchronizing test execution stages with received 
events */
+ast_mutex_t mid_test_sync_lock;
+
+/*! \brief Lock used with sync_out for checking the end of test execution */
+ast_mutex_t sync_lock;
+
+/*! \brief Condition used for checking the end of test execution */
+ast_cond_t sync_out;
+
+/*! \brief Flag used to trigger a mid-test synchronization, access controlled 
by mid_test_sync_lock */
+int do_mid_test_sync = 0;
+
 /*! \brief A channel technology used for the unit tests */
 static struct ast_channel_tech test_cel_chan_tech = {
        .type = CHANNEL_TECH_NAME,
@@ -96,6 +108,7 @@
 #define CONF_EXIT(channel, bridge) do { \
        ast_test_validate(test, 0 == ast_bridge_depart(channel)); \
        CONF_EXIT_EVENT(channel, bridge); \
+       mid_test_sync(); \
        } while (0)
 
 #define CONF_EXIT_EVENT(channel, bridge) do { \
@@ -227,6 +240,8 @@
        APPEND_EVENT(channel, AST_CEL_HANGUP, NULL, extra, NULL); \
        } while (0)
 
+static void mid_test_sync(void);
+
 static int append_expected_event(
        struct ast_channel *chan,
        enum ast_cel_event_type type,
@@ -544,6 +559,10 @@
        return AST_TEST_PASS;
 }
 
+/* XXX Validation needs to be reworked on a per-channel basis before
+ * test_cel_single_multiparty_bridge and test_cel_dial_answer_multiparty
+ * can operate properly. */
+#if 0
 AST_TEST_DEFINE(test_cel_single_multiparty_bridge)
 {
        RAII_VAR(struct ast_channel *, chan_alice, NULL, safe_channel_release);
@@ -597,11 +616,8 @@
        BRIDGE_TO_CONF(chan_alice, chan_bob, chan_charlie, bridge);
 
        CONF_EXIT(chan_alice, bridge);
-       do_sleep();
        CONF_EXIT(chan_bob, bridge);
-       do_sleep();
        CONF_EXIT(chan_charlie, bridge);
-       do_sleep();
 
        HANGUP_CHANNEL(chan_alice, AST_CAUSE_NORMAL, "");
        HANGUP_CHANNEL(chan_bob, AST_CAUSE_NORMAL, "");
@@ -609,6 +625,7 @@
 
        return AST_TEST_PASS;
 }
+#endif
 
 #define EMULATE_DIAL(channel, dialstring) do { \
        EMULATE_APP_DATA(channel, 1, "Dial", dialstring); \
@@ -1000,6 +1017,7 @@
        return AST_TEST_PASS;
 }
 
+#if 0
 AST_TEST_DEFINE(test_cel_dial_answer_multiparty)
 {
        RAII_VAR(struct ast_channel *, chan_alice, NULL, safe_channel_release);
@@ -1072,11 +1090,8 @@
        CONF_ENTER_EVENT(chan_alice, bridge);
 
        CONF_EXIT(chan_alice, bridge);
-       do_sleep();
        CONF_EXIT(chan_bob, bridge);
-       do_sleep();
        CONF_EXIT(chan_charlie, bridge);
-       do_sleep();
        CONF_EXIT(chan_david, bridge);
 
        HANGUP_CHANNEL(chan_alice, AST_CAUSE_NORMAL, "ANSWER");
@@ -1086,6 +1101,7 @@
 
        return AST_TEST_PASS;
 }
+#endif
 
 AST_TEST_DEFINE(test_cel_blind_transfer)
 {
@@ -1212,10 +1228,8 @@
 
        do_sleep();
        CONF_EXIT(chan_bob, bridge2);
-       do_sleep();
        CONF_EXIT(chan_charlie, bridge2);
 
-       do_sleep();
        HANGUP_CHANNEL(chan_alice, AST_CAUSE_NORMAL, "");
        do_sleep();
        HANGUP_CHANNEL(chan_bob, AST_CAUSE_NORMAL, "");
@@ -1300,10 +1314,8 @@
 
        do_sleep();
        CONF_EXIT(chan_bob, bridge1);
-       do_sleep();
        CONF_EXIT(chan_charlie, bridge1);
 
-       do_sleep();
        HANGUP_CHANNEL(chan_alice, AST_CAUSE_NORMAL, "");
        do_sleep();
        HANGUP_CHANNEL(chan_bob, AST_CAUSE_NORMAL, "");
@@ -1411,10 +1423,8 @@
 
        do_sleep();
        CONF_EXIT(chan_bob, bridge1);
-       do_sleep();
        CONF_EXIT(chan_charlie, bridge2);
 
-       do_sleep();
        HANGUP_CHANNEL(chan_alice, AST_CAUSE_NORMAL, "");
        do_sleep();
        HANGUP_CHANNEL(chan_bob, AST_CAUSE_NORMAL, "");
@@ -1558,6 +1568,29 @@
        return event_dup;
 }
 
+static void mid_test_sync(void)
+{
+       ast_mutex_lock(&mid_test_sync_lock);
+       if (ao2_container_count(cel_expected_events) <= 
ao2_container_count(cel_received_events)) {
+               ast_mutex_unlock(&mid_test_sync_lock);
+               return;
+       }
+
+       do_mid_test_sync = 1;
+       ast_mutex_unlock(&mid_test_sync_lock);
+
+       {
+               struct timeval start = ast_tvnow();
+               struct timespec end = {
+                       .tv_sec = start.tv_sec + 15,
+                       .tv_nsec = start.tv_usec * 1000
+               };
+
+               SCOPED_MUTEX(lock, &sync_lock);
+               ast_cond_timedwait(&sync_out, &sync_lock, &end);
+       }
+}
+
 static int append_event(struct ast_event *ev)
 {
        RAII_VAR(struct ast_event *, ao2_ev, NULL, ao2_cleanup);
@@ -1613,13 +1646,12 @@
        return append_expected_event_snapshot(snapshot, type, userdefevname, 
extra, peer);
 }
 
-ast_mutex_t sync_lock;
-ast_cond_t sync_out;
-
 static void test_sub(const struct ast_event *event, void *data)
 {
        struct ast_event *event_dup = ao2_dup_event(event);
        const char *sync_tag;
+       SCOPED_MUTEX(mid_test_lock, &mid_test_sync_lock);
+
        if (!event_dup) {
                return;
        }
@@ -1633,8 +1665,21 @@
                        return;
                }
        }
+
        /* save the event for later processing */
        ao2_link(cel_received_events, event_dup);
+
+       if (do_mid_test_sync) {
+               int expected = ao2_container_count(cel_expected_events);
+               int received = ao2_container_count(cel_received_events);
+               if (expected <= received) {
+                       {
+                       SCOPED_MUTEX(lock, &sync_lock);
+                       ast_cond_signal(&sync_out);
+                       do_mid_test_sync = 0;
+                       }
+               }
+       }
 }
 
 /*!
@@ -1646,6 +1691,7 @@
        ast_assert(cel_received_events == NULL);
        ast_assert(cel_expected_events == NULL);
 
+       ast_mutex_init(&mid_test_sync_lock);
        ast_mutex_init(&sync_lock);
        ast_cond_init(&sync_out, NULL);
 
@@ -1885,7 +1931,7 @@
        } else {
                struct timeval start = ast_tvnow();
                struct timespec end = {
-                       .tv_sec = start.tv_sec + 30,
+                       .tv_sec = start.tv_sec + 15,
                        .tv_nsec = start.tv_usec * 1000
                };
 
@@ -1911,6 +1957,7 @@
 
        /* clean up the locks */
        ast_mutex_destroy(&sync_lock);
+       ast_mutex_destroy(&mid_test_sync_lock);
        ast_cond_destroy(&sync_out);
        return 0;
 }
@@ -1925,7 +1972,7 @@
        AST_TEST_UNREGISTER(test_cel_single_bridge_continue);
        AST_TEST_UNREGISTER(test_cel_single_twoparty_bridge_a);
        AST_TEST_UNREGISTER(test_cel_single_twoparty_bridge_b);
-       AST_TEST_UNREGISTER(test_cel_single_multiparty_bridge);
+       /*AST_TEST_UNREGISTER(test_cel_single_multiparty_bridge);*/
 
        AST_TEST_UNREGISTER(test_cel_dial_unanswered);
        AST_TEST_UNREGISTER(test_cel_dial_congestion);
@@ -1936,7 +1983,7 @@
        AST_TEST_UNREGISTER(test_cel_dial_answer_no_bridge);
        AST_TEST_UNREGISTER(test_cel_dial_answer_twoparty_bridge_a);
        AST_TEST_UNREGISTER(test_cel_dial_answer_twoparty_bridge_b);
-       AST_TEST_UNREGISTER(test_cel_dial_answer_multiparty);
+       /*AST_TEST_UNREGISTER(test_cel_dial_answer_multiparty);*/
 
        AST_TEST_UNREGISTER(test_cel_blind_transfer);
        AST_TEST_UNREGISTER(test_cel_attended_transfer_bridges_swap);
@@ -1998,7 +2045,7 @@
        AST_TEST_REGISTER(test_cel_single_bridge_continue);
        AST_TEST_REGISTER(test_cel_single_twoparty_bridge_a);
        AST_TEST_REGISTER(test_cel_single_twoparty_bridge_b);
-       AST_TEST_REGISTER(test_cel_single_multiparty_bridge);
+       /*AST_TEST_REGISTER(test_cel_single_multiparty_bridge);*/
 
        AST_TEST_REGISTER(test_cel_dial_unanswered);
        AST_TEST_REGISTER(test_cel_dial_congestion);
@@ -2009,7 +2056,7 @@
        AST_TEST_REGISTER(test_cel_dial_answer_no_bridge);
        AST_TEST_REGISTER(test_cel_dial_answer_twoparty_bridge_a);
        AST_TEST_REGISTER(test_cel_dial_answer_twoparty_bridge_b);
-       AST_TEST_REGISTER(test_cel_dial_answer_multiparty);
+       /*AST_TEST_REGISTER(test_cel_dial_answer_multiparty);*/
 
        AST_TEST_REGISTER(test_cel_blind_transfer);
        AST_TEST_REGISTER(test_cel_attended_transfer_bridges_swap);


--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

svn-commits mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/svn-commits

Reply via email to