sip/sdp: Hack to get a GSM codec call connected

Extract IP and port once we have received the INVITE. In the near
future we need to improve this!
This commit is contained in:
Holger Hans Peter Freyther 2016-03-31 16:28:21 +02:00
parent c2474dc0be
commit 2a7cfb5c93
3 changed files with 19 additions and 4 deletions

View File

@ -90,7 +90,7 @@ success:
return true;
}
bool sdp_extract_sdp(struct sip_call_leg *leg, const sip_t *sip)
bool sdp_extract_sdp(struct sip_call_leg *leg, const sip_t *sip, bool any_codec)
{
sdp_connection_t *conn;
sdp_session_t *sdp;
@ -139,7 +139,7 @@ bool sdp_extract_sdp(struct sip_call_leg *leg, const sip_t *sip)
continue;
for (map = media->m_rtpmaps; map; map = map->rm_next) {
if (strcasecmp(map->rm_encoding, leg->wanted_codec) != 0)
if (!any_codec && strcasecmp(map->rm_encoding, leg->wanted_codec) != 0)
continue;
leg->base.port = media->m_port;

View File

@ -8,6 +8,6 @@ struct sip_call_leg;
struct call_leg;
bool sdp_screen_sdp(const sip_t *sip);
bool sdp_extract_sdp(struct sip_call_leg *leg, const sip_t *sip);
bool sdp_extract_sdp(struct sip_call_leg *leg, const sip_t *sip, bool any_codec);
char *sdp_create_file(struct sip_call_leg *, struct call_leg *);

View File

@ -60,7 +60,7 @@ static void call_connect(struct sip_call_leg *leg, const sip_t *sip)
return;
}
if (!sdp_extract_sdp(leg, sip)) {
if (!sdp_extract_sdp(leg, sip, false)) {
LOGP(DSIP, LOGL_ERROR, "leg(%p) incompatible audio, releasing\n", leg);
nua_cancel(leg->nua_handle, TAG_END());
other->release_call(other);
@ -113,6 +113,21 @@ static void new_call(struct sip_agent *agent, nua_handle_t *nh,
leg->state = SIP_CC_DLG_CNFD;
leg->dir = SIP_DIR_MO;
/*
* FIXME/TODO.. we need to select the codec at some point. But it is
* not this place. It starts with the TCH/F vs. TCH/H selection based
* on the offered codecs, and then RTP_CREATE should have it. So both
* are GSM related... and do not belong here. Just pick the first codec
* so the IP addresss port and payload type is set.
*/
if (!sdp_extract_sdp(leg, sip, true)) {
LOGP(DSIP, LOGL_ERROR, "leg(%p) no audio, releasing\n", leg);
nua_respond(nh, SIP_406_NOT_ACCEPTABLE, TAG_END());
nua_handle_destroy(nh);
call_leg_release(&leg->base);
return;
}
leg->base.release_call = sip_release_call;
leg->base.ring_call = sip_ring_call;
leg->base.connect_call = sip_connect_call;