Skip to content

Commit

Permalink
Fix for proper handling of handling custom headers for Dial SIP
Browse files Browse the repository at this point in the history
  • Loading branch information
gvagenas committed Mar 8, 2018
1 parent 9585bcc commit 2b4b146
Showing 1 changed file with 15 additions and 6 deletions.
Expand Up @@ -2374,14 +2374,16 @@ else if (CallManagerResponse.class.equals(klass) && !((CallManagerResponse)messa
to = child.text();
}

//Extract and pass custom headers for Dial Client and Dial Number
//No need to support Dial SIP because custom headers are already in the SIP URI
String customHeaders = getCustomHeaders(to);

//Get Callee after removing any custom headers (this way there will be no impact on the Extensions execution)
String callee = customHeaders != null ? to.substring(0, to.indexOf("?")) : to;
String callee = to;

if (Nouns.client.equals(child.name())) {
//Extract and pass custom headers for Dial Client and Dial Number
//No need to support Dial SIP because custom headers are already in the SIP URI
String customHeaders = getCustomHeaders(to);

//Get Callee after removing any custom headers (this way there will be no impact on the Extensions execution)
callee = customHeaders != null ? to.substring(0, to.indexOf("?")) : to;

if (call != null && callInfo != null) {
create = new CreateCall(e164(callerId(verb)), e164(callee), null, null, callInfo.isFromApi(), timeout(verb),
CreateCallType.CLIENT, accountId, callInfo.sid(), statusCallback, statusCallbackMethod, statusCallbackEvent, mediaAttributes, customHeaders);
Expand All @@ -2390,6 +2392,13 @@ else if (CallManagerResponse.class.equals(klass) && !((CallManagerResponse)messa
CreateCallType.CLIENT, accountId, null, statusCallback, statusCallbackMethod, statusCallbackEvent, mediaAttributes, customHeaders);
}
} else if (Nouns.number.equals(child.name())) {
//Extract and pass custom headers for Dial Client and Dial Number
//No need to support Dial SIP because custom headers are already in the SIP URI
String customHeaders = getCustomHeaders(to);

//Get Callee after removing any custom headers (this way there will be no impact on the Extensions execution)
callee = customHeaders != null ? to.substring(0, to.indexOf("?")) : to;

if (call != null && callInfo != null) {
create = new CreateCall(e164(callerId(verb)), e164(callee), null, null, callInfo.isFromApi(), timeout(verb),
CreateCallType.PSTN, accountId, callInfo.sid(), statusCallback, statusCallbackMethod, statusCallbackEvent, customHeaders);
Expand Down

0 comments on commit 2b4b146

Please sign in to comment.