Commit a7c1b747 authored by Alexandre Savard's avatar Alexandre Savard

#5954: Handle media name exception

parent 65fb1d01
......@@ -991,34 +991,38 @@ SIPVoIPLink::offhold (const CallID& id) throw (VoipLinkException)
throw VoipLinkException("Could not find sdp session");
}
// Retreive previously selected codec
AudioCodecType pl;
sfl::Codec *sessionMedia = sdpSession->getSessionMedia();
if (sessionMedia == NULL) {
// throw VoipLinkException("Could not find session media");
_warn("UserAgent: Session media not yet initialized, using default (ULAW)");
pl = PAYLOAD_CODEC_ULAW;
}
else {
// Get PayloadType for this codec
pl = (AudioCodecType) sessionMedia->getPayloadType();
}
try {
// Retreive previously selected codec
AudioCodecType pl;
sfl::Codec *sessionMedia = sdpSession->getSessionMedia();
if (sessionMedia == NULL) {
// throw VoipLinkException("Could not find session media");
_warn("UserAgent: Session media not yet initialized, using default (ULAW)");
pl = PAYLOAD_CODEC_ULAW;
}
else {
// Get PayloadType for this codec
pl = (AudioCodecType) sessionMedia->getPayloadType();
}
_debug ("UserAgent: Payload from session media %d", pl);
_debug ("UserAgent: Payload from session media %d", pl);
// Create a new instance for this codec
sfl::Codec* audiocodec = Manager::instance().getCodecDescriptorMap().instantiateCodec (pl);
if (audiocodec == NULL) {
throw VoipLinkException("Could not instantiate codec");
}
// Create a new instance for this codec
sfl::Codec* audiocodec = Manager::instance().getCodecDescriptorMap().instantiateCodec (pl);
if (audiocodec == NULL) {
throw VoipLinkException("Could not instantiate codec");
}
try {
call->getAudioRtp()->initAudioRtpConfig (call);
call->getAudioRtp()->initAudioRtpSession (call);
call->getAudioRtp()->start (static_cast<AudioCodec *>(audiocodec));
} catch (...) {
}
catch (SdpException &e) {
_error("UserAgent: Exception: %s", e.what());
}
catch (...) {
throw VoipLinkException("Could not create audio rtp session");
}
......@@ -1351,20 +1355,24 @@ SIPVoIPLink::getCurrentCodecName(const CallID& id)
sfl::Codec *ac = NULL;
std::string name = "";
// call = getSIPCall (Manager::instance().getCurrentCallId());
call = getSIPCall (id);
if(call == NULL) {
_error("UserAgent: Error: No current call");
// return empty string
return name;
}
try {
// call = getSIPCall (Manager::instance().getCurrentCallId());
call = getSIPCall (id);
if(call == NULL) {
_error("UserAgent: Error: No current call");
// return empty string
return name;
}
if(call->getLocalSDP()->hasSessionMedia()) {
ac = call->getLocalSDP()->getSessionMedia();
if(call->getLocalSDP()->hasSessionMedia()) {
ac = call->getLocalSDP()->getSessionMedia();
}
else {
return name;
}
}
else {
return name;
catch (SdpException &e) {
_error("UserAgent: Exception: %s", e.what());
}
if (ac == NULL) {
......@@ -3522,8 +3530,12 @@ void sdp_media_update_cb (pjsip_inv_session *inv, pj_status_t status)
call->getAudioRtp()->updateSessionMedia (static_cast<AudioCodec *>(audiocodec));
}
} catch (exception& rtpException) {
_error ("UserAgent: Error: %s", rtpException.what());
}
catch (exception& rtpException) {
_error ("UserAgent: Exception: %s", rtpException.what());
}
catch (SdpException &e) {
_error("UserAgent: Exception: %s", e.what());
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment