diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/account.c | 18 | ||||
-rw-r--r-- | src/call.c | 18 | ||||
-rw-r--r-- | src/config.c | 4 | ||||
-rw-r--r-- | src/core.h | 2 | ||||
-rw-r--r-- | src/message.c | 11 | ||||
-rw-r--r-- | src/sdp.c | 8 | ||||
-rw-r--r-- | src/stream.c | 3 | ||||
-rw-r--r-- | src/ua.c | 4 |
8 files changed, 36 insertions, 32 deletions
diff --git a/src/account.c b/src/account.c index 95ceeba..b8945b1 100644 --- a/src/account.c +++ b/src/account.c @@ -43,7 +43,7 @@ static int param_dstr(char **dstr, const struct pl *params, const char *name) { struct pl pl; - if (sip_param_decode(params, name, &pl)) + if (msg_param_decode(params, name, &pl)) return 0; return pl_strdup(dstr, &pl); @@ -54,7 +54,7 @@ static int param_u32(uint32_t *v, const struct pl *params, const char *name) { struct pl pl; - if (sip_param_decode(params, name, &pl)) + if (msg_param_decode(params, name, &pl)) return 0; *v = pl_u32(&pl); @@ -74,7 +74,7 @@ static int stunsrv_decode(struct account *acc, const struct sip_addr *aor) memset(&uri, 0, sizeof(uri)); - if (0 == sip_param_decode(&aor->params, "stunserver", &srv)) { + if (0 == msg_param_decode(&aor->params, "stunserver", &srv)) { info("using stunserver: '%r'\n", &srv); @@ -134,7 +134,7 @@ static void answermode_decode(struct account *prm, const struct pl *pl) { struct pl amode; - if (0 == sip_param_decode(pl, "answermode", &amode)) { + if (0 == msg_param_decode(pl, "answermode", &amode)) { if (0 == pl_strcasecmp(&amode, "manual")) { prm->answermode = ANSWERMODE_MANUAL; @@ -180,12 +180,12 @@ static int audio_codecs_decode(struct account *acc, const struct pl *prm) list_init(&acc->aucodecl); - if (0 == sip_param_exists(prm, "audio_codecs", &tmp)) { + if (0 == msg_param_exists(prm, "audio_codecs", &tmp)) { struct pl acs; char cname[64]; unsigned i = 0; - if (sip_param_decode(prm, "audio_codecs", &acs)) + if (msg_param_decode(prm, "audio_codecs", &acs)) return 0; while (0 == csl_parse(&acs, cname, sizeof(cname))) { @@ -236,12 +236,12 @@ static int video_codecs_decode(struct account *acc, const struct pl *prm) list_init(&acc->vidcodecl); - if (0 == sip_param_exists(prm, "video_codecs", &tmp)) { + if (0 == msg_param_exists(prm, "video_codecs", &tmp)) { struct pl vcs; char cname[64]; unsigned i = 0; - if (sip_param_decode(prm, "video_codecs", &vcs)) + if (msg_param_decode(prm, "video_codecs", &vcs)) return 0; while (0 == csl_parse(&vcs, cname, sizeof(cname))) { @@ -298,7 +298,7 @@ static int sip_params_decode(struct account *acc, const struct sip_addr *aor) err |= param_dstr(&acc->sipnat, &aor->params, "sipnat"); - if (0 == sip_param_decode(&aor->params, "auth_user", &auth_user)) + if (0 == msg_param_decode(&aor->params, "auth_user", &auth_user)) err |= pl_strdup(&acc->auth_user, &auth_user); else err |= pl_strdup(&acc->auth_user, &aor->uri.user); @@ -958,7 +958,8 @@ static int sipsess_answer_handler(const struct sip_msg *msg, void *arg) MAGIC_CHECK(call); - (void)sdp_decode_multipart(&msg->ctype, msg->mb); + if (msg_ctype_cmp(&msg->ctyp, "multipart", "mixed")) + (void)sdp_decode_multipart(&msg->ctyp.params, msg->mb); err = sdp_decode(call->sdp, msg->mb, false); if (err) { @@ -1034,7 +1035,7 @@ static void sipsess_info_handler(struct sip *sip, const struct sip_msg *msg, { struct call *call = arg; - if (!pl_strcasecmp(&msg->ctype, "application/dtmf-relay")) { + if (msg_ctype_cmp(&msg->ctyp, "application", "dtmf-relay")) { struct pl body, sig, dur; int err; @@ -1067,8 +1068,8 @@ static void sipsess_info_handler(struct sip *sip, const struct sip_msg *msg, } } #ifdef USE_VIDEO - else if (!pl_strcasecmp(&msg->ctype, - "application/media_control+xml")) { + else if (msg_ctype_cmp(&msg->ctyp, + "application", "media_control+xml")) { call_handle_info_req(call, msg); (void)sip_reply(sip, msg, 200, "OK"); } @@ -1231,8 +1232,8 @@ static void sipsess_progr_handler(const struct sip_msg *msg, void *arg) MAGIC_CHECK(call); - info("call: SIP Progress: %u %r (%r)\n", - msg->scode, &msg->reason, &msg->ctype); + info("call: SIP Progress: %u %r (%r/%r)\n", + msg->scode, &msg->reason, &msg->ctyp.type, &msg->ctyp.subtype); if (msg->scode <= 100) return; @@ -1245,12 +1246,13 @@ static void sipsess_progr_handler(const struct sip_msg *msg, void *arg) * we must also handle changes to/from 180 and 183, * so we reset the media-stream/ringback each time. */ - if (!pl_strcasecmp(&msg->ctype, "application/sdp") + if (msg_ctype_cmp(&msg->ctyp, "application", "sdp") && mbuf_get_left(msg->mb) && !sdp_decode(call->sdp, msg->mb, false)) { media = true; } - else if (!sdp_decode_multipart(&msg->ctype, msg->mb) && + else if (msg_ctype_cmp(&msg->ctyp, "multipart", "mixed") && + !sdp_decode_multipart(&msg->ctyp.params, msg->mb) && !sdp_decode(call->sdp, msg->mb, false)) { media = true; } diff --git a/src/config.c b/src/config.c index dd65c52..4a84b67 100644 --- a/src/config.c +++ b/src/config.c @@ -334,6 +334,8 @@ static const char *default_audio_device(void) return "oss,/dev/dsp"; #elif defined (WIN32) return "winwave,nil"; +#elif defined (ANDROID) + return "opensles"; #else return "alsa,default"; #endif @@ -583,6 +585,8 @@ int config_write_template(const char *file, const struct config *cfg) (void)re_fprintf(f, "module\t\t\t" MOD_PRE "mda" MOD_EXT "\n"); #elif defined (DARWIN) (void)re_fprintf(f, "module\t\t\t" MOD_PRE "coreaudio" MOD_EXT "\n"); +#elif defined (ANDROID) + (void)re_fprintf(f, "module\t\t\t" MOD_PRE "opensles" MOD_EXT "\n"); #else (void)re_fprintf(f, "module\t\t\t" MOD_PRE "oss" MOD_EXT "\n"); (void)re_fprintf(f, "module\t\t\t" MOD_PRE "alsa" MOD_EXT "\n"); @@ -283,7 +283,7 @@ int sip_req_send(struct ua *ua, const char *method, const char *uri, * SDP */ -int sdp_decode_multipart(const struct pl *ctype, struct mbuf *mb); +int sdp_decode_multipart(const struct pl *ctype_prm, struct mbuf *mb); const struct sdp_format *sdp_media_format_cycle(struct sdp_media *m); diff --git a/src/message.c b/src/message.c index b0e33e1..9d3662b 100644 --- a/src/message.c +++ b/src/message.c @@ -15,15 +15,12 @@ static void *recvarg; static void handle_message(struct ua *ua, const struct sip_msg *msg) { - static const char *ctype_text = "text/plain"; - struct pl mtype; + static const char ctype_text[] = "text/plain"; + struct pl ctype_pl = {ctype_text, sizeof(ctype_text)-1}; (void)ua; - if (re_regex(msg->ctype.p, msg->ctype.l, "[^;]+", &mtype)) - mtype = msg->ctype; - - if (0==pl_strcasecmp(&mtype, ctype_text) && recvh) { - recvh(&msg->from.auri, &msg->ctype, msg->mb, recvarg); + if (msg_ctype_cmp(&msg->ctyp, "text", "plain") && recvh) { + recvh(&msg->from.auri, &ctype_pl, msg->mb, recvarg); (void)sip_reply(uag_sip(), msg, 200, "OK"); } else { @@ -145,18 +145,18 @@ static void decode_part(const struct pl *part, struct mbuf *mb) /** * Decode a multipart/mixed message and find the part with application/sdp */ -int sdp_decode_multipart(const struct pl *ctype, struct mbuf *mb) +int sdp_decode_multipart(const struct pl *ctype_prm, struct mbuf *mb) { struct pl bnd, s, e, p; char expr[64]; int err; - if (!ctype || !mb) + if (!ctype_prm || !mb) return EINVAL; /* fetch the boundary tag, excluding quotes */ - err = re_regex(ctype->p, ctype->l, - "multipart/mixed;[ \t]*boundary=[~]+", NULL, &bnd); + err = re_regex(ctype_prm->p, ctype_prm->l, + "boundary=[~]+", &bnd); if (err) return err; diff --git a/src/stream.c b/src/stream.c index 122cd96..f30bf0c 100644 --- a/src/stream.c +++ b/src/stream.c @@ -565,7 +565,8 @@ int stream_debug(struct re_printf *pf, const struct stream *s) s->pt_enc); sdp_media_raddr_rtcp(s->sdp, &rrtcp); - err |= re_hprintf(pf, " remote: %J/%J\n", + err |= re_hprintf(pf, " local: %J, remote: %J/%J\n", + sdp_media_laddr(s->sdp), sdp_media_raddr(s->sdp), &rrtcp); err |= rtp_debug(pf, s->rtp); @@ -1424,14 +1424,14 @@ struct ua *uag_find_param(const char *name, const char *value) if (value) { - if (0 == sip_param_decode(&laddr->params, name, &val) + if (0 == msg_param_decode(&laddr->params, name, &val) && 0 == pl_strcasecmp(&val, value)) { return ua; } } else { - if (0 == sip_param_exists(&laddr->params, name, &val)) + if (0 == msg_param_exists(&laddr->params, name, &val)) return ua; } } |