mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-15 06:18:38 +00:00
chan_pjsip: Add support for picking up calls in the configured pickup group.
AST-1363 Review: https://reviewboard.asterisk.org/r/3478/ ........ Merged revisions 413117 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@413118 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -43,6 +43,8 @@
|
||||
#include "asterisk/sdp_srtp.h"
|
||||
#include "asterisk/dsp.h"
|
||||
#include "asterisk/acl.h"
|
||||
#include "asterisk/features_config.h"
|
||||
#include "asterisk/pickup.h"
|
||||
|
||||
#define SDP_HANDLER_BUCKETS 11
|
||||
|
||||
@@ -1349,12 +1351,27 @@ static enum sip_get_destination_result get_destination(struct ast_sip_session *s
|
||||
{
|
||||
pjsip_uri *ruri = rdata->msg_info.msg->line.req.uri;
|
||||
pjsip_sip_uri *sip_ruri;
|
||||
struct ast_features_pickup_config *pickup_cfg;
|
||||
const char *pickupexten;
|
||||
|
||||
if (!PJSIP_URI_SCHEME_IS_SIP(ruri) && !PJSIP_URI_SCHEME_IS_SIPS(ruri)) {
|
||||
return SIP_GET_DEST_UNSUPPORTED_URI;
|
||||
}
|
||||
|
||||
sip_ruri = pjsip_uri_get_uri(ruri);
|
||||
ast_copy_pj_str(session->exten, &sip_ruri->user, sizeof(session->exten));
|
||||
if (ast_exists_extension(NULL, session->endpoint->context, session->exten, 1, NULL)) {
|
||||
|
||||
pickup_cfg = ast_get_chan_features_pickup_config(session->channel);
|
||||
if (!pickup_cfg) {
|
||||
ast_log(LOG_ERROR, "Unable to retrieve pickup configuration options. Unable to detect call pickup extension\n");
|
||||
pickupexten = "";
|
||||
} else {
|
||||
pickupexten = ast_strdupa(pickup_cfg->pickupexten);
|
||||
ao2_ref(pickup_cfg, -1);
|
||||
}
|
||||
|
||||
if (!strcmp(session->exten, pickupexten) ||
|
||||
ast_exists_extension(NULL, session->endpoint->context, session->exten, 1, NULL)) {
|
||||
return SIP_GET_DEST_EXTEN_FOUND;
|
||||
}
|
||||
/* XXX In reality, we'll likely have further options so that partial matches
|
||||
|
||||
Reference in New Issue
Block a user