[asterisk-commits] phsultan: branch 1.6.0 r118615 - in /branches/1.6.0: ./ channels/chan_jingle.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed May 28 03:44:16 CDT 2008
Author: phsultan
Date: Wed May 28 03:44:15 2008
New Revision: 118615
URL: http://svn.digium.com/view/asterisk?view=rev&rev=118615
Log:
Merged revisions 118614 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk
........
r118614 | phsultan | 2008-05-28 10:39:10 +0200 (Wed, 28 May 2008) | 1 line
Code simplification
........
Modified:
branches/1.6.0/ (props changed)
branches/1.6.0/channels/chan_jingle.c
Propchange: branches/1.6.0/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.
Modified: branches/1.6.0/channels/chan_jingle.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/channels/chan_jingle.c?view=diff&rev=118615&r1=118614&r2=118615
==============================================================================
--- branches/1.6.0/channels/chan_jingle.c (original)
+++ branches/1.6.0/channels/chan_jingle.c Wed May 28 03:44:15 2008
@@ -955,7 +955,7 @@
struct jingle_pvt *p, *tmp = client->p;
struct ast_channel *chan;
int res;
- iks *payload_type;
+ iks *codec;
/* Make sure our new call doesn't exist yet */
while (tmp) {
@@ -973,45 +973,47 @@
return -1;
}
chan = jingle_new(client, p, AST_STATE_DOWN, pak->from->user);
- if (chan) {
- ast_mutex_lock(&p->lock);
- ast_copy_string(p->them, pak->from->full, sizeof(p->them));
- if (iks_find_attrib(pak->query, JINGLE_SID)) {
- ast_copy_string(p->sid, iks_find_attrib(pak->query, JINGLE_SID),
- sizeof(p->sid));
- }
-
- payload_type = iks_child(iks_child(iks_child(iks_child(pak->x))));
- while (payload_type) {
- ast_rtp_set_m_type(p->rtp, atoi(iks_find_attrib(payload_type, "id")));
- ast_rtp_set_rtpmap_type(p->rtp, atoi(iks_find_attrib(payload_type, "id")), "audio", iks_find_attrib(payload_type, "name"), 0);
- payload_type = iks_next(payload_type);
- }
-
- ast_mutex_unlock(&p->lock);
- ast_setstate(chan, AST_STATE_RING);
- res = ast_pbx_start(chan);
-
- switch (res) {
- case AST_PBX_FAILED:
- ast_log(LOG_WARNING, "Failed to start PBX :(\n");
- jingle_response(client, pak, "service-unavailable", NULL);
- break;
- case AST_PBX_CALL_LIMIT:
- ast_log(LOG_WARNING, "Failed to start PBX (call limit reached) \n");
- jingle_response(client, pak, "service-unavailable", NULL);
- break;
- case AST_PBX_SUCCESS:
- jingle_response(client, pak, NULL, NULL);
- jingle_create_candidates(client, p,
- iks_find_attrib(pak->query, JINGLE_SID),
- iks_find_attrib(pak->x, "from"));
- /* nothing to do */
- break;
- }
- } else {
+ if (!chan) {
jingle_free_pvt(client, p);
- }
+ return -1;
+ }
+ ast_mutex_lock(&p->lock);
+ ast_copy_string(p->them, pak->from->full, sizeof(p->them));
+ if (iks_find_attrib(pak->query, JINGLE_SID)) {
+ ast_copy_string(p->sid, iks_find_attrib(pak->query, JINGLE_SID),
+ sizeof(p->sid));
+ }
+
+ /* codec points to the first <payload-type/> tag */
+ codec = iks_child(iks_child(iks_child(iks_child(pak->x))));
+ while (codec) {
+ ast_rtp_set_m_type(p->rtp, atoi(iks_find_attrib(codec, "id")));
+ ast_rtp_set_rtpmap_type(p->rtp, atoi(iks_find_attrib(codec, "id")), "audio", iks_find_attrib(codec, "name"), 0);
+ codec = iks_next(codec);
+ }
+
+ ast_mutex_unlock(&p->lock);
+ ast_setstate(chan, AST_STATE_RING);
+ res = ast_pbx_start(chan);
+
+ switch (res) {
+ case AST_PBX_FAILED:
+ ast_log(LOG_WARNING, "Failed to start PBX :(\n");
+ jingle_response(client, pak, "service-unavailable", NULL);
+ break;
+ case AST_PBX_CALL_LIMIT:
+ ast_log(LOG_WARNING, "Failed to start PBX (call limit reached) \n");
+ jingle_response(client, pak, "service-unavailable", NULL);
+ break;
+ case AST_PBX_SUCCESS:
+ jingle_response(client, pak, NULL, NULL);
+ jingle_create_candidates(client, p,
+ iks_find_attrib(pak->query, JINGLE_SID),
+ iks_find_attrib(pak->x, "from"));
+ /* nothing to do */
+ break;
+ }
+
return 1;
}
More information about the asterisk-commits
mailing list