Code simplification

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@118614 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Philippe Sultan
2008-05-28 08:39:10 +00:00
parent a06df81624
commit 2ab8f076bf

View File

@@ -956,7 +956,7 @@ static int jingle_newcall(struct jingle *client, ikspak *pak)
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) {
@@ -974,7 +974,10 @@ static int jingle_newcall(struct jingle *client, ikspak *pak)
return -1;
}
chan = jingle_new(client, p, AST_STATE_DOWN, pak->from->user);
if (chan) {
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)) {
@@ -982,11 +985,12 @@ static int jingle_newcall(struct jingle *client, ikspak *pak)
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);
/* 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);
@@ -1010,9 +1014,7 @@ static int jingle_newcall(struct jingle *client, ikspak *pak)
/* nothing to do */
break;
}
} else {
jingle_free_pvt(client, p);
}
return 1;
}