2007-03-31 19:01:33 +00:00
|
|
|
/*
|
|
|
|
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
|
|
|
* Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
|
|
|
|
*
|
|
|
|
* Version: MPL 1.1
|
|
|
|
*
|
|
|
|
* The contents of this file are subject to the Mozilla Public License Version
|
|
|
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
|
|
|
* the License. You may obtain a copy of the License at
|
|
|
|
* http://www.mozilla.org/MPL/
|
|
|
|
*
|
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* License.
|
|
|
|
*
|
|
|
|
* The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is
|
|
|
|
* Anthony Minessale II <anthmct@yahoo.com>
|
|
|
|
* Portions created by the Initial Developer are Copyright (C)
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
|
|
|
*
|
|
|
|
* Anthony Minessale II <anthmct@yahoo.com>
|
|
|
|
* Ken Rice, Asteria Solutions Group, Inc <ken@asteriasgi.com>
|
|
|
|
* Paul D. Tinsley <pdt at jackhammer.org>
|
|
|
|
* Bret McDanel <trixter AT 0xdecafbad.com>
|
2007-04-07 03:04:46 +00:00
|
|
|
* Marcel Barbulescu <marcelbarbulescu@gmail.com>
|
2007-03-31 19:01:33 +00:00
|
|
|
*
|
|
|
|
*
|
|
|
|
* mod_sofia.h -- SOFIA SIP Endpoint
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*Defines etc..*/
|
|
|
|
/*************************************************************************************************************************************************************/
|
|
|
|
#define IREG_SECONDS 30
|
|
|
|
#define GATEWAY_SECONDS 1
|
|
|
|
|
|
|
|
#define HAVE_APR
|
|
|
|
#include <switch.h>
|
2007-10-05 15:47:48 +00:00
|
|
|
#include <switch_version.h>
|
2007-04-04 03:08:17 +00:00
|
|
|
#ifdef SWITCH_HAVE_ODBC
|
|
|
|
#include <switch_odbc.h>
|
|
|
|
#endif
|
2008-05-14 14:13:40 +00:00
|
|
|
#define SOFIA_NAT_SESSION_TIMEOUT 20
|
2008-03-26 22:14:09 +00:00
|
|
|
#define SOFIA_MAX_ACL 100
|
2008-06-27 16:36:09 +00:00
|
|
|
#ifdef _MSC_VER
|
|
|
|
#define HAVE_FUNCTION 1
|
|
|
|
#else
|
|
|
|
#define HAVE_FUNC 1
|
|
|
|
#endif
|
2008-03-26 22:14:09 +00:00
|
|
|
|
2007-06-13 14:35:55 +00:00
|
|
|
#define MODNAME "mod_sofia"
|
2007-03-31 19:01:33 +00:00
|
|
|
static const switch_state_handler_table_t noop_state_handler = { 0 };
|
2007-04-29 01:16:49 +00:00
|
|
|
struct sofia_gateway;
|
|
|
|
typedef struct sofia_gateway sofia_gateway_t;
|
2007-03-31 19:01:33 +00:00
|
|
|
|
|
|
|
struct sofia_profile;
|
|
|
|
typedef struct sofia_profile sofia_profile_t;
|
|
|
|
#define NUA_MAGIC_T sofia_profile_t
|
|
|
|
|
|
|
|
typedef struct sofia_private sofia_private_t;
|
|
|
|
|
|
|
|
struct private_object;
|
|
|
|
typedef struct private_object private_object_t;
|
|
|
|
#define NUA_HMAGIC_T sofia_private_t
|
|
|
|
|
2007-10-19 21:06:09 +00:00
|
|
|
#define SOFIA_SESSION_TIMEOUT "sofia_session_timeout"
|
2007-03-31 19:01:33 +00:00
|
|
|
#define MY_EVENT_REGISTER "sofia::register"
|
2008-05-16 18:40:09 +00:00
|
|
|
#define MY_EVENT_UNREGISTER "sofia::unregister"
|
2007-03-31 19:01:33 +00:00
|
|
|
#define MY_EVENT_EXPIRE "sofia::expire"
|
2008-05-16 18:40:09 +00:00
|
|
|
|
2007-03-31 19:01:33 +00:00
|
|
|
#define MULTICAST_EVENT "multicast::event"
|
|
|
|
#define SOFIA_REPLACES_HEADER "_sofia_replaces_"
|
2008-01-25 16:39:02 +00:00
|
|
|
#define SOFIA_USER_AGENT "FreeSWITCH-mod_sofia/" SWITCH_VERSION_MAJOR "." SWITCH_VERSION_MINOR "." SWITCH_VERSION_MICRO "-" SWITCH_VERSION_REVISION
|
2007-03-31 19:01:33 +00:00
|
|
|
#define SOFIA_CHAT_PROTO "sip"
|
|
|
|
#define SOFIA_SIP_HEADER_PREFIX "sip_h_"
|
2008-07-22 14:04:51 +00:00
|
|
|
#define SOFIA_SIP_BYE_HEADER_PREFIX "sip_bye_h_"
|
2007-03-31 19:01:33 +00:00
|
|
|
#define SOFIA_SIP_HEADER_PREFIX_T "~sip_h_"
|
|
|
|
#define SOFIA_DEFAULT_PORT "5060"
|
2007-12-18 19:12:45 +00:00
|
|
|
#define SOFIA_DEFAULT_TLS_PORT "5061"
|
2007-12-28 22:53:04 +00:00
|
|
|
#define SOFIA_REFER_TO_VARIABLE "sip_refer_to"
|
2008-01-16 06:01:53 +00:00
|
|
|
#define SOFIA_SECURE_MEDIA_VARIABLE "sip_secure_media"
|
|
|
|
#define SOFIA_SECURE_MEDIA_CONFIRMED_VARIABLE "sip_secure_media_confirmed"
|
|
|
|
#define SOFIA_HAS_CRYPTO_VARIABLE "sip_has_crypto"
|
2008-02-26 21:13:47 +00:00
|
|
|
#define SOFIA_CRYPTO_MANDATORY_VARIABLE "sip_crypto_mandatory"
|
2007-03-31 19:01:33 +00:00
|
|
|
|
|
|
|
#include <sofia-sip/nua.h>
|
|
|
|
#include <sofia-sip/sip_status.h>
|
|
|
|
#include <sofia-sip/sdp.h>
|
|
|
|
#include <sofia-sip/sip_protos.h>
|
|
|
|
#include <sofia-sip/auth_module.h>
|
|
|
|
#include <sofia-sip/su_md5.h>
|
|
|
|
#include <sofia-sip/su_log.h>
|
|
|
|
#include <sofia-sip/nea.h>
|
|
|
|
#include <sofia-sip/msg_addr.h>
|
2008-05-30 20:29:32 +00:00
|
|
|
#include "nua_stack.h"
|
2007-03-31 19:01:33 +00:00
|
|
|
|
2007-12-22 00:32:20 +00:00
|
|
|
typedef enum {
|
|
|
|
DTMF_2833,
|
|
|
|
DTMF_INFO,
|
|
|
|
DTMF_NONE
|
|
|
|
} sofia_dtmf_t;
|
|
|
|
|
2007-04-13 22:15:58 +00:00
|
|
|
struct sofia_private {
|
|
|
|
char uuid[SWITCH_UUID_FORMATTED_LENGTH + 1];
|
2007-04-29 01:16:49 +00:00
|
|
|
sofia_gateway_t *gateway;
|
2008-04-30 22:09:54 +00:00
|
|
|
char gateway_name[512];
|
2008-05-06 22:56:55 +00:00
|
|
|
int destroy_nh;
|
2008-05-09 19:35:51 +00:00
|
|
|
int destroy_me;
|
2008-07-29 17:54:42 +00:00
|
|
|
int is_call;
|
2007-04-13 22:15:58 +00:00
|
|
|
};
|
|
|
|
|
2007-03-31 19:01:33 +00:00
|
|
|
#define set_param(ptr,val) if (ptr) {free(ptr) ; ptr = NULL;} if (val) {ptr = strdup(val);}
|
|
|
|
#define set_anchor(t,m) if (t->Anchor) {delete t->Anchor;} t->Anchor = new SipMessage(m);
|
|
|
|
|
|
|
|
/* Local Structures */
|
|
|
|
/*************************************************************************************************************************************************************/
|
|
|
|
struct sip_alias_node {
|
|
|
|
char *url;
|
|
|
|
nua_t *nua;
|
|
|
|
struct sip_alias_node *next;
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct sip_alias_node sip_alias_node_t;
|
|
|
|
|
2008-03-07 14:36:08 +00:00
|
|
|
typedef enum {
|
|
|
|
MFLAG_REFER = (1 << 0),
|
|
|
|
MFLAG_REGISTER = (1 << 1)
|
|
|
|
} MFLAGS;
|
|
|
|
|
2007-03-31 19:01:33 +00:00
|
|
|
typedef enum {
|
|
|
|
PFLAG_AUTH_CALLS = (1 << 0),
|
|
|
|
PFLAG_BLIND_REG = (1 << 1),
|
|
|
|
PFLAG_AUTH_ALL = (1 << 2),
|
|
|
|
PFLAG_FULL_ID = (1 << 3),
|
|
|
|
PFLAG_PRESENCE = (1 << 4),
|
|
|
|
PFLAG_PASS_RFC2833 = (1 << 5),
|
2007-04-05 19:29:48 +00:00
|
|
|
PFLAG_DISABLE_TRANSCODING = (1 << 6),
|
2007-04-29 01:16:49 +00:00
|
|
|
PFLAG_REWRITE_TIMESTAMPS = (1 << 7),
|
2007-05-01 00:26:41 +00:00
|
|
|
PFLAG_RUNNING = (1 << 8),
|
2007-06-10 02:52:23 +00:00
|
|
|
PFLAG_RESPAWN = (1 << 9),
|
2007-10-18 01:02:01 +00:00
|
|
|
PFLAG_GREEDY = (1 << 10),
|
2007-11-12 20:36:00 +00:00
|
|
|
PFLAG_MULTIREG = (1 << 11),
|
2007-12-18 19:12:45 +00:00
|
|
|
PFLAG_SUPRESS_CNG = (1 << 12),
|
2008-01-12 19:15:05 +00:00
|
|
|
PFLAG_TLS = (1 << 13),
|
2008-01-16 06:01:53 +00:00
|
|
|
PFLAG_CHECKUSER = (1 << 14),
|
2008-03-04 01:23:55 +00:00
|
|
|
PFLAG_SECURE = (1 << 15),
|
2008-03-04 23:53:23 +00:00
|
|
|
PFLAG_BLIND_AUTH = (1 << 16),
|
|
|
|
PFLAG_WORKER_RUNNING = (1 << 17),
|
2008-04-14 19:20:12 +00:00
|
|
|
PFLAG_UNREG_OPTIONS_FAIL = (1 << 18),
|
|
|
|
PFLAG_DISABLE_TIMER = (1 << 19),
|
2008-05-21 16:46:48 +00:00
|
|
|
PFLAG_DISABLE_100REL = (1 << 20),
|
2008-05-22 17:24:10 +00:00
|
|
|
PFLAG_AGGRESSIVE_NAT_DETECTION = (1 << 21),
|
2008-05-29 20:02:06 +00:00
|
|
|
PFLAG_RECIEVED_IN_NAT_REG_CONTACT = (1 << 22),
|
2008-07-07 17:56:16 +00:00
|
|
|
PFLAG_3PCC = (1 << 23),
|
|
|
|
PFLAG_DISABLE_RTP_AUTOADJ = (1 << 24),
|
2008-07-18 16:18:31 +00:00
|
|
|
PFLAG_DISABLE_SRTP_AUTH = (1 << 25),
|
2008-07-21 16:40:28 +00:00
|
|
|
PFLAG_FUNNY_STUN = (1 << 26),
|
|
|
|
PFLAG_STUN_ENABLED = (1 << 27),
|
|
|
|
PFLAG_STUN_AUTO_DISABLE = (1 << 28)
|
2007-03-31 19:01:33 +00:00
|
|
|
} PFLAGS;
|
|
|
|
|
2007-05-29 14:59:03 +00:00
|
|
|
typedef enum {
|
2007-08-21 14:48:16 +00:00
|
|
|
PFLAG_NDLB_TO_IN_200_CONTACT = (1 << 0),
|
|
|
|
PFLAG_NDLB_BROKEN_AUTH_HASH = (1 << 1)
|
2007-05-29 14:59:03 +00:00
|
|
|
} sofia_NDLB_t;
|
|
|
|
|
2008-07-18 16:18:31 +00:00
|
|
|
typedef enum {
|
|
|
|
STUN_FLAG_SET = (1 << 0),
|
|
|
|
STUN_FLAG_PING = (1 << 1),
|
|
|
|
STUN_FLAG_FUNNY = (1 << 2)
|
|
|
|
} STUNFLAGS;
|
|
|
|
|
2007-03-31 19:01:33 +00:00
|
|
|
typedef enum {
|
|
|
|
TFLAG_IO = (1 << 0),
|
|
|
|
TFLAG_CHANGE_MEDIA = (1 << 1),
|
|
|
|
TFLAG_OUTBOUND = (1 << 2),
|
|
|
|
TFLAG_READING = (1 << 3),
|
|
|
|
TFLAG_WRITING = (1 << 4),
|
|
|
|
TFLAG_HUP = (1 << 5),
|
|
|
|
TFLAG_RTP = (1 << 6),
|
|
|
|
TFLAG_BYE = (1 << 7),
|
|
|
|
TFLAG_ANS = (1 << 8),
|
|
|
|
TFLAG_EARLY_MEDIA = (1 << 9),
|
|
|
|
TFLAG_SECURE = (1 << 10),
|
|
|
|
TFLAG_VAD_IN = (1 << 11),
|
|
|
|
TFLAG_VAD_OUT = (1 << 12),
|
|
|
|
TFLAG_VAD = (1 << 13),
|
|
|
|
TFLAG_TIMER = (1 << 14),
|
|
|
|
TFLAG_READY = (1 << 15),
|
|
|
|
TFLAG_REINVITE = (1 << 16),
|
|
|
|
TFLAG_REFER = (1 << 17),
|
|
|
|
TFLAG_NOHUP = (1 << 18),
|
|
|
|
TFLAG_XFER = (1 << 19),
|
2008-05-13 23:22:21 +00:00
|
|
|
TFLAG_NAT = (1 << 20),
|
2007-03-31 19:01:33 +00:00
|
|
|
TFLAG_BUGGY_2833 = (1 << 21),
|
|
|
|
TFLAG_SIP_HOLD = (1 << 22),
|
|
|
|
TFLAG_INB_NOMEDIA = (1 << 23),
|
2007-04-19 21:40:50 +00:00
|
|
|
TFLAG_LATE_NEGOTIATION = (1 << 24),
|
|
|
|
TFLAG_SDP = (1 << 25),
|
2007-12-13 02:42:00 +00:00
|
|
|
TFLAG_VIDEO = (1 << 26),
|
2008-01-26 03:56:40 +00:00
|
|
|
TFLAG_TPORT_LOG = (1 << 27),
|
2008-02-21 17:48:41 +00:00
|
|
|
TFLAG_SENT_UPDATE = (1 << 28),
|
|
|
|
TFLAG_PROXY_MEDIA = (1 << 29)
|
2007-03-31 19:01:33 +00:00
|
|
|
} TFLAGS;
|
|
|
|
|
2007-04-01 01:16:16 +00:00
|
|
|
struct mod_sofia_globals {
|
2008-03-14 03:46:54 +00:00
|
|
|
switch_memory_pool_t *pool;
|
2007-03-31 19:01:33 +00:00
|
|
|
switch_hash_t *profile_hash;
|
|
|
|
switch_hash_t *gateway_hash;
|
|
|
|
switch_mutex_t *hash_mutex;
|
|
|
|
uint32_t callid;
|
|
|
|
int32_t running;
|
2007-04-13 23:19:51 +00:00
|
|
|
int32_t threads;
|
2007-03-31 19:01:33 +00:00
|
|
|
switch_mutex_t *mutex;
|
|
|
|
char guess_ip[80];
|
2008-03-14 03:46:54 +00:00
|
|
|
switch_queue_t *presence_queue;
|
|
|
|
switch_queue_t *mwi_queue;
|
2008-05-06 22:56:55 +00:00
|
|
|
struct sofia_private destroy_private;
|
2008-05-07 20:06:46 +00:00
|
|
|
struct sofia_private keep_private;
|
2008-07-03 23:54:35 +00:00
|
|
|
switch_event_node_t *in_node;
|
|
|
|
switch_event_node_t *probe_node;
|
|
|
|
switch_event_node_t *out_node;
|
|
|
|
switch_event_node_t *roster_node;
|
|
|
|
switch_event_node_t *custom_node;
|
|
|
|
switch_event_node_t *mwi_node;
|
2007-03-31 19:01:33 +00:00
|
|
|
};
|
2007-04-01 01:16:16 +00:00
|
|
|
extern struct mod_sofia_globals mod_sofia_globals;
|
2007-03-31 19:01:33 +00:00
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
REG_FLAG_AUTHED = (1 << 0),
|
2007-04-20 16:05:37 +00:00
|
|
|
REG_FLAG_CALLERID = (1 << 1)
|
2007-03-31 19:01:33 +00:00
|
|
|
} reg_flags_t;
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
REG_STATE_UNREGED,
|
|
|
|
REG_STATE_TRYING,
|
|
|
|
REG_STATE_REGISTER,
|
|
|
|
REG_STATE_REGED,
|
2007-09-18 17:31:36 +00:00
|
|
|
REG_STATE_UNREGISTER,
|
2007-03-31 19:01:33 +00:00
|
|
|
REG_STATE_FAILED,
|
2007-04-07 03:04:46 +00:00
|
|
|
REG_STATE_EXPIRED,
|
2007-05-01 15:22:57 +00:00
|
|
|
REG_STATE_NOREG,
|
|
|
|
REG_STATE_LAST
|
2007-03-31 19:01:33 +00:00
|
|
|
} reg_state_t;
|
|
|
|
|
2008-01-17 17:37:49 +00:00
|
|
|
typedef enum {
|
|
|
|
SOFIA_TRANSPORT_UNKNOWN = 0,
|
|
|
|
SOFIA_TRANSPORT_UDP,
|
|
|
|
SOFIA_TRANSPORT_TCP,
|
|
|
|
SOFIA_TRANSPORT_TCP_TLS,
|
|
|
|
SOFIA_TRANSPORT_SCTP
|
|
|
|
} sofia_transport_t;
|
|
|
|
|
2008-04-30 22:09:54 +00:00
|
|
|
typedef enum {
|
|
|
|
SOFIA_GATEWAY_DOWN,
|
|
|
|
SOFIA_GATEWAY_UP
|
|
|
|
} sofia_gateway_status_t;
|
|
|
|
|
2007-04-29 01:16:49 +00:00
|
|
|
struct sofia_gateway {
|
2007-03-31 19:01:33 +00:00
|
|
|
sofia_private_t *sofia_private;
|
|
|
|
nua_handle_t *nh;
|
|
|
|
sofia_profile_t *profile;
|
|
|
|
char *name;
|
|
|
|
char *register_scheme;
|
|
|
|
char *register_realm;
|
|
|
|
char *register_username;
|
2008-08-15 19:30:34 +00:00
|
|
|
char *auth_username;
|
2007-03-31 19:01:33 +00:00
|
|
|
char *register_password;
|
|
|
|
char *register_from;
|
|
|
|
char *register_contact;
|
|
|
|
char *register_to;
|
|
|
|
char *register_proxy;
|
2008-08-01 18:18:35 +00:00
|
|
|
char *register_sticky_proxy;
|
2007-03-31 19:01:33 +00:00
|
|
|
char *register_context;
|
|
|
|
char *expires_str;
|
2007-09-19 15:28:16 +00:00
|
|
|
char *register_url;
|
2008-01-17 17:37:49 +00:00
|
|
|
sofia_transport_t register_transport;
|
2007-03-31 19:01:33 +00:00
|
|
|
uint32_t freq;
|
|
|
|
time_t expires;
|
|
|
|
time_t retry;
|
2008-04-30 22:09:54 +00:00
|
|
|
time_t ping;
|
|
|
|
int pinging;
|
|
|
|
sofia_gateway_status_t status;
|
|
|
|
uint32_t ping_freq;
|
2007-03-31 19:01:33 +00:00
|
|
|
uint32_t flags;
|
2007-05-10 16:15:07 +00:00
|
|
|
int32_t retry_seconds;
|
2007-03-31 19:01:33 +00:00
|
|
|
reg_state_t state;
|
|
|
|
switch_memory_pool_t *pool;
|
2008-07-08 22:05:34 +00:00
|
|
|
int deleted;
|
2007-04-29 01:16:49 +00:00
|
|
|
struct sofia_gateway *next;
|
2007-03-31 19:01:33 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct sofia_profile {
|
|
|
|
int debug;
|
|
|
|
char *name;
|
2008-01-21 20:14:53 +00:00
|
|
|
char *domain_name;
|
2007-03-31 19:01:33 +00:00
|
|
|
char *dbname;
|
|
|
|
char *dialplan;
|
|
|
|
char *context;
|
|
|
|
char *extrtpip;
|
|
|
|
char *rtpip;
|
|
|
|
char *sipip;
|
|
|
|
char *extsipip;
|
|
|
|
char *username;
|
|
|
|
char *url;
|
|
|
|
char *bindurl;
|
2007-12-18 19:12:45 +00:00
|
|
|
char *tls_url;
|
|
|
|
char *tls_bindurl;
|
2007-03-31 19:01:33 +00:00
|
|
|
char *sipdomain;
|
|
|
|
char *timer_name;
|
|
|
|
char *hold_music;
|
2007-05-08 20:17:27 +00:00
|
|
|
char *bind_params;
|
2007-12-18 19:12:45 +00:00
|
|
|
char *tls_bind_params;
|
|
|
|
char *tls_cert_dir;
|
2007-10-25 20:25:32 +00:00
|
|
|
char *reg_domain;
|
2007-11-27 01:21:36 +00:00
|
|
|
char *user_agent;
|
2007-12-22 00:32:20 +00:00
|
|
|
char *record_template;
|
|
|
|
sofia_dtmf_t dtmf_type;
|
2007-03-31 19:01:33 +00:00
|
|
|
int sip_port;
|
2007-12-18 19:12:45 +00:00
|
|
|
int tls_sip_port;
|
2007-12-22 23:50:15 +00:00
|
|
|
int tls_version;
|
2007-03-31 19:01:33 +00:00
|
|
|
char *codec_string;
|
|
|
|
int running;
|
|
|
|
int dtmf_duration;
|
|
|
|
unsigned int flags;
|
|
|
|
unsigned int pflags;
|
2008-03-07 14:36:08 +00:00
|
|
|
unsigned int mflags;
|
2007-05-29 14:59:03 +00:00
|
|
|
unsigned int ndlb;
|
2007-03-31 19:01:33 +00:00
|
|
|
uint32_t max_calls;
|
|
|
|
uint32_t nonce_ttl;
|
|
|
|
nua_t *nua;
|
|
|
|
switch_memory_pool_t *pool;
|
|
|
|
su_root_t *s_root;
|
|
|
|
sip_alias_node_t *aliases;
|
|
|
|
switch_payload_t te;
|
|
|
|
switch_payload_t cng_pt;
|
|
|
|
uint32_t codec_flags;
|
|
|
|
switch_mutex_t *ireg_mutex;
|
|
|
|
switch_mutex_t *gateway_mutex;
|
2007-04-29 01:16:49 +00:00
|
|
|
sofia_gateway_t *gateways;
|
2007-03-31 19:01:33 +00:00
|
|
|
su_home_t *home;
|
|
|
|
switch_hash_t *chat_hash;
|
2007-04-04 03:08:17 +00:00
|
|
|
switch_core_db_t *master_db;
|
2007-04-29 01:16:49 +00:00
|
|
|
switch_thread_rwlock_t *rwlock;
|
|
|
|
switch_mutex_t *flag_mutex;
|
|
|
|
uint32_t inuse;
|
2007-05-02 23:32:45 +00:00
|
|
|
time_t started;
|
2007-10-19 21:06:09 +00:00
|
|
|
uint32_t session_timeout;
|
|
|
|
uint32_t max_proceeding;
|
2007-10-31 02:12:30 +00:00
|
|
|
uint32_t rtp_timeout_sec;
|
2008-01-21 00:35:33 +00:00
|
|
|
uint32_t rtp_hold_timeout_sec;
|
2007-04-04 03:08:17 +00:00
|
|
|
char *odbc_dsn;
|
|
|
|
char *odbc_user;
|
|
|
|
char *odbc_pass;
|
|
|
|
switch_odbc_handle_t *master_odbc;
|
2008-03-04 23:53:23 +00:00
|
|
|
switch_queue_t *sql_queue;
|
2008-03-26 22:14:09 +00:00
|
|
|
char *acl[SOFIA_MAX_ACL];
|
|
|
|
uint32_t acl_count;
|
|
|
|
char *reg_acl[SOFIA_MAX_ACL];
|
|
|
|
uint32_t reg_acl_count;
|
2008-05-13 23:22:21 +00:00
|
|
|
char *nat_acl[SOFIA_MAX_ACL];
|
|
|
|
uint32_t nat_acl_count;
|
2008-06-05 15:55:06 +00:00
|
|
|
int rport_level;
|
2007-03-31 19:01:33 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct private_object {
|
|
|
|
sofia_private_t *sofia_private;
|
|
|
|
uint32_t flags;
|
|
|
|
switch_payload_t agreed_pt;
|
|
|
|
switch_core_session_t *session;
|
2007-05-09 19:30:41 +00:00
|
|
|
switch_channel_t *channel;
|
2007-03-31 19:01:33 +00:00
|
|
|
switch_frame_t read_frame;
|
|
|
|
char *codec_order[SWITCH_MAX_CODECS];
|
|
|
|
int codec_order_last;
|
|
|
|
const switch_codec_implementation_t *codecs[SWITCH_MAX_CODECS];
|
|
|
|
int num_codecs;
|
|
|
|
switch_codec_t read_codec;
|
|
|
|
switch_codec_t write_codec;
|
|
|
|
uint32_t codec_ms;
|
|
|
|
switch_caller_profile_t *caller_profile;
|
|
|
|
uint32_t timestamp_send;
|
|
|
|
switch_rtp_t *rtp_session;
|
|
|
|
int ssrc;
|
|
|
|
sofia_profile_t *profile;
|
|
|
|
char *local_sdp_audio_ip;
|
|
|
|
switch_port_t local_sdp_audio_port;
|
|
|
|
char *remote_sdp_audio_ip;
|
|
|
|
switch_port_t remote_sdp_audio_port;
|
|
|
|
char *adv_sdp_audio_ip;
|
|
|
|
switch_port_t adv_sdp_audio_port;
|
|
|
|
char *proxy_sdp_audio_ip;
|
|
|
|
switch_port_t proxy_sdp_audio_port;
|
2007-05-29 14:59:03 +00:00
|
|
|
char *reply_contact;
|
2007-03-31 19:01:33 +00:00
|
|
|
char *from_uri;
|
|
|
|
char *to_uri;
|
|
|
|
char *from_address;
|
|
|
|
char *to_address;
|
|
|
|
char *callid;
|
|
|
|
char *far_end_contact;
|
|
|
|
char *contact_url;
|
|
|
|
char *from_str;
|
2007-11-21 00:56:41 +00:00
|
|
|
char *rpid;
|
2007-04-10 02:25:29 +00:00
|
|
|
char *gateway_from_str;
|
2007-03-31 19:01:33 +00:00
|
|
|
char *rm_encoding;
|
2007-11-21 17:07:41 +00:00
|
|
|
char *iananame;
|
2007-03-31 19:01:33 +00:00
|
|
|
char *rm_fmtp;
|
|
|
|
char *fmtp_out;
|
|
|
|
char *remote_sdp_str;
|
|
|
|
char *local_sdp_str;
|
2008-02-21 17:48:41 +00:00
|
|
|
char *orig_local_sdp_str;
|
2007-03-31 19:01:33 +00:00
|
|
|
char *dest;
|
|
|
|
char *dest_to;
|
|
|
|
char *key;
|
|
|
|
char *xferto;
|
|
|
|
char *kick;
|
|
|
|
char *origin;
|
|
|
|
char *hash_key;
|
|
|
|
char *chat_from;
|
|
|
|
char *chat_to;
|
|
|
|
char *e_dest;
|
|
|
|
char *call_id;
|
2007-04-04 16:44:08 +00:00
|
|
|
char *invite_contact;
|
2007-11-30 21:02:41 +00:00
|
|
|
char *local_url;
|
2007-12-04 13:48:20 +00:00
|
|
|
char *gateway_name;
|
2008-01-16 06:01:53 +00:00
|
|
|
char *local_crypto_key;
|
|
|
|
char *remote_crypto_key;
|
2008-05-13 23:22:21 +00:00
|
|
|
char *record_route;
|
2008-07-18 16:18:31 +00:00
|
|
|
char *extrtpip;
|
|
|
|
char *stun_ip;
|
2008-07-18 20:25:39 +00:00
|
|
|
switch_port_t stun_port;
|
2008-07-18 16:18:31 +00:00
|
|
|
uint32_t stun_flags;
|
2008-01-16 21:28:20 +00:00
|
|
|
int crypto_tag;
|
2008-01-16 06:01:53 +00:00
|
|
|
unsigned char local_raw_key[SWITCH_RTP_MAX_CRYPTO_LEN];
|
|
|
|
unsigned char remote_raw_key[SWITCH_RTP_MAX_CRYPTO_LEN];
|
|
|
|
switch_rtp_crypto_key_type_t crypto_send_type;
|
|
|
|
switch_rtp_crypto_key_type_t crypto_recv_type;
|
|
|
|
switch_rtp_crypto_key_type_t crypto_type;
|
2007-03-31 19:01:33 +00:00
|
|
|
unsigned long rm_rate;
|
|
|
|
switch_payload_t pt;
|
|
|
|
switch_mutex_t *flag_mutex;
|
|
|
|
switch_payload_t te;
|
|
|
|
switch_payload_t bte;
|
|
|
|
switch_payload_t cng_pt;
|
|
|
|
switch_payload_t bcng_pt;
|
2008-01-17 17:37:49 +00:00
|
|
|
sofia_transport_t transport;
|
2007-03-31 19:01:33 +00:00
|
|
|
nua_handle_t *nh;
|
|
|
|
nua_handle_t *nh2;
|
|
|
|
sip_contact_t *contact;
|
2007-04-19 22:49:01 +00:00
|
|
|
uint32_t owner_id;
|
|
|
|
uint32_t session_id;
|
2007-10-31 17:30:50 +00:00
|
|
|
uint32_t max_missed_packets;
|
2008-01-21 00:35:33 +00:00
|
|
|
uint32_t max_missed_hold_packets;
|
2007-04-19 21:40:50 +00:00
|
|
|
/** VIDEO **/
|
|
|
|
switch_frame_t video_read_frame;
|
|
|
|
switch_codec_t video_read_codec;
|
|
|
|
switch_codec_t video_write_codec;
|
|
|
|
switch_rtp_t *video_rtp_session;
|
|
|
|
switch_port_t adv_sdp_video_port;
|
|
|
|
switch_port_t local_sdp_video_port;
|
|
|
|
char *video_rm_encoding;
|
|
|
|
switch_payload_t video_pt;
|
|
|
|
unsigned long video_rm_rate;
|
|
|
|
uint32_t video_codec_ms;
|
|
|
|
char *remote_sdp_video_ip;
|
|
|
|
switch_port_t remote_sdp_video_port;
|
|
|
|
char *video_rm_fmtp;
|
|
|
|
switch_payload_t video_agreed_pt;
|
|
|
|
char *video_fmtp_out;
|
|
|
|
uint32_t video_count;
|
2007-12-22 00:32:20 +00:00
|
|
|
sofia_dtmf_t dtmf_type;
|
2008-02-02 00:49:25 +00:00
|
|
|
int q850_cause;
|
2008-05-13 23:22:21 +00:00
|
|
|
char *remote_ip;
|
|
|
|
int remote_port;
|
2008-08-01 16:21:51 +00:00
|
|
|
int got_bye;
|
2007-03-31 19:01:33 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct callback_t {
|
|
|
|
char *val;
|
|
|
|
switch_size_t len;
|
|
|
|
int matches;
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
REG_REGISTER,
|
2008-05-13 23:22:21 +00:00
|
|
|
REG_AUTO_REGISTER,
|
|
|
|
REG_INVITE,
|
2007-03-31 19:01:33 +00:00
|
|
|
} sofia_regtype_t;
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
AUTH_OK,
|
|
|
|
AUTH_FORBIDDEN,
|
|
|
|
AUTH_STALE,
|
|
|
|
} auth_res_t;
|
|
|
|
|
2007-04-29 01:16:49 +00:00
|
|
|
#define sofia_test_pflag(obj, flag) ((obj)->pflags & flag)
|
|
|
|
#define sofia_set_pflag(obj, flag) (obj)->pflags |= (flag)
|
|
|
|
#define sofia_set_pflag_locked(obj, flag) assert(obj->flag_mutex != NULL);\
|
|
|
|
switch_mutex_lock(obj->flag_mutex);\
|
|
|
|
(obj)->pflags |= (flag);\
|
|
|
|
switch_mutex_unlock(obj->flag_mutex);
|
|
|
|
#define sofia_clear_pflag_locked(obj, flag) switch_mutex_lock(obj->flag_mutex); (obj)->pflags &= ~(flag); switch_mutex_unlock(obj->flag_mutex);
|
|
|
|
#define sofia_clear_pflag(obj, flag) (obj)->pflags &= ~(flag)
|
|
|
|
#define sofia_copy_pflags(dest, src, flags) (dest)->pflags &= ~(flags); (dest)->pflags |= ((src)->pflags & (flags))
|
|
|
|
|
2007-03-31 19:01:33 +00:00
|
|
|
/* Function Prototypes */
|
|
|
|
/*************************************************************************************************************************************************************/
|
|
|
|
|
2007-10-25 18:36:40 +00:00
|
|
|
switch_status_t sofia_glue_activate_rtp(private_object_t *tech_pvt, switch_rtp_flag_t myflags);
|
2007-03-31 19:01:33 +00:00
|
|
|
|
2007-04-13 22:15:58 +00:00
|
|
|
void sofia_glue_deactivate_rtp(private_object_t *tech_pvt);
|
2007-03-31 19:01:33 +00:00
|
|
|
|
2007-11-01 11:28:26 +00:00
|
|
|
void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, uint32_t port, const char *sr, int force);
|
2007-03-31 19:01:33 +00:00
|
|
|
|
2007-04-17 06:08:39 +00:00
|
|
|
void sofia_glue_tech_prepare_codecs(private_object_t *tech_pvt);
|
2007-03-31 19:01:33 +00:00
|
|
|
|
2007-04-13 22:15:58 +00:00
|
|
|
void sofia_glue_attach_private(switch_core_session_t *session, sofia_profile_t *profile, private_object_t *tech_pvt, const char *channame);
|
2007-03-31 19:01:33 +00:00
|
|
|
|
2008-02-21 17:48:41 +00:00
|
|
|
switch_status_t sofia_glue_tech_choose_port(private_object_t *tech_pvt, int force);
|
2007-03-31 19:01:33 +00:00
|
|
|
|
|
|
|
switch_status_t sofia_glue_do_invite(switch_core_session_t *session);
|
|
|
|
|
2007-04-17 06:08:39 +00:00
|
|
|
uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, sdp_session_t *sdp);
|
2007-03-31 19:01:33 +00:00
|
|
|
|
2007-04-13 22:15:58 +00:00
|
|
|
void sofia_presence_establish_presence(sofia_profile_t *profile);
|
2007-03-31 19:01:33 +00:00
|
|
|
|
2007-04-13 22:15:58 +00:00
|
|
|
void sofia_handle_sip_i_refer(nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, switch_core_session_t *session, sip_t const *sip, tagi_t tags[]);
|
2007-03-31 19:01:33 +00:00
|
|
|
|
2007-04-13 22:15:58 +00:00
|
|
|
void sofia_handle_sip_i_info(nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, switch_core_session_t *session, sip_t const *sip, tagi_t tags[]);
|
2007-03-31 19:01:33 +00:00
|
|
|
|
2007-04-13 22:15:58 +00:00
|
|
|
void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[]);
|
2007-03-31 19:01:33 +00:00
|
|
|
|
2007-04-13 22:15:58 +00:00
|
|
|
void sofia_reg_handle_sip_i_register(nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[]);
|
2007-03-31 19:01:33 +00:00
|
|
|
|
|
|
|
void sofia_event_callback(nua_event_t event,
|
|
|
|
int status,
|
|
|
|
char const *phrase,
|
2007-04-13 22:15:58 +00:00
|
|
|
nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[]);
|
2007-03-31 19:01:33 +00:00
|
|
|
|
2007-04-13 22:15:58 +00:00
|
|
|
void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void *obj);
|
2007-03-31 19:01:33 +00:00
|
|
|
|
2007-04-13 22:15:58 +00:00
|
|
|
void launch_sofia_profile_thread(sofia_profile_t *profile);
|
2007-03-31 19:01:33 +00:00
|
|
|
|
|
|
|
switch_status_t sofia_presence_chat_send(char *proto, char *from, char *to, char *subject, char *body, char *hint);
|
2007-04-13 22:15:58 +00:00
|
|
|
void sofia_glue_tech_absorb_sdp(private_object_t *tech_pvt);
|
2007-11-01 11:28:26 +00:00
|
|
|
switch_status_t sofia_glue_tech_media(private_object_t *tech_pvt, const char *r_sdp);
|
2007-04-13 22:15:58 +00:00
|
|
|
char *sofia_reg_find_reg_url(sofia_profile_t *profile, const char *user, const char *host, char *val, switch_size_t len);
|
2007-03-31 19:01:33 +00:00
|
|
|
void event_handler(switch_event_t *event);
|
|
|
|
void sofia_presence_event_handler(switch_event_t *event);
|
2007-04-02 19:54:25 +00:00
|
|
|
void sofia_presence_mwi_event_handler(switch_event_t *event);
|
2007-03-31 19:01:33 +00:00
|
|
|
void sofia_presence_cancel(void);
|
2007-04-29 01:16:49 +00:00
|
|
|
switch_status_t config_sofia(int reload, char *profile_name);
|
2008-05-20 22:28:34 +00:00
|
|
|
void sofia_reg_auth_challange(nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_regtype_t regtype, const char *realm, int stale);
|
2008-01-17 19:25:01 +00:00
|
|
|
auth_res_t sofia_reg_parse_auth(sofia_profile_t *profile, sip_authorization_t const *authorization, sip_t const *sip, const char *regstr,
|
|
|
|
char *np, size_t nplen, char *ip, switch_event_t **v_event, long exptime, sofia_regtype_t regtype, const char *to_user);
|
|
|
|
|
2007-03-31 19:01:33 +00:00
|
|
|
void sofia_reg_handle_sip_r_challenge(int status,
|
2007-12-04 00:21:32 +00:00
|
|
|
char const *phrase,
|
|
|
|
nua_t *nua, sofia_profile_t *profile,
|
|
|
|
nua_handle_t *nh, switch_core_session_t *session, sofia_gateway_t *gateway, sip_t const *sip, tagi_t tags[]);
|
2007-03-31 19:01:33 +00:00
|
|
|
void sofia_reg_handle_sip_r_register(int status,
|
|
|
|
char const *phrase,
|
2007-04-13 22:15:58 +00:00
|
|
|
nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[]);
|
2007-03-31 19:01:33 +00:00
|
|
|
void sofia_handle_sip_i_options(int status,
|
|
|
|
char const *phrase,
|
2007-04-13 22:15:58 +00:00
|
|
|
nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[]);
|
|
|
|
void sofia_presence_handle_sip_i_publish(nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[]);
|
2007-03-31 19:01:33 +00:00
|
|
|
void sofia_presence_handle_sip_i_message(int status,
|
|
|
|
char const *phrase,
|
2007-04-13 22:15:58 +00:00
|
|
|
nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[]);
|
2007-03-31 19:01:33 +00:00
|
|
|
void sofia_presence_handle_sip_r_subscribe(int status,
|
|
|
|
char const *phrase,
|
2007-04-13 22:15:58 +00:00
|
|
|
nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[]);
|
2007-03-31 19:01:33 +00:00
|
|
|
void sofia_presence_handle_sip_i_subscribe(int status,
|
|
|
|
char const *phrase,
|
2007-04-13 22:15:58 +00:00
|
|
|
nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[]);
|
2007-03-31 19:01:33 +00:00
|
|
|
|
2008-03-17 16:12:38 +00:00
|
|
|
void sofia_glue_execute_sql(sofia_profile_t *profile, char **sqlp, switch_bool_t sql_already_dynamic);
|
2008-03-04 23:53:23 +00:00
|
|
|
void sofia_glue_actually_execute_sql(sofia_profile_t *profile, switch_bool_t master, char *sql, switch_mutex_t *mutex);
|
2008-07-17 20:47:42 +00:00
|
|
|
void sofia_reg_check_expire(sofia_profile_t *profile, time_t now, int reboot);
|
2007-04-13 22:15:58 +00:00
|
|
|
void sofia_reg_check_gateway(sofia_profile_t *profile, time_t now);
|
|
|
|
void sofia_reg_unregister(sofia_profile_t *profile);
|
2008-07-18 16:18:31 +00:00
|
|
|
switch_status_t sofia_glue_ext_address_lookup(sofia_profile_t *profile, private_object_t *tech_pvt, char **ip, switch_port_t *port, char *sourceip, switch_memory_pool_t *pool);
|
2007-05-03 01:55:25 +00:00
|
|
|
|
2007-04-13 22:15:58 +00:00
|
|
|
void sofia_glue_pass_sdp(private_object_t *tech_pvt, char *sdp);
|
2007-04-02 19:54:25 +00:00
|
|
|
int sofia_glue_get_user_host(char *in, char **user, char **host);
|
2007-03-31 19:01:33 +00:00
|
|
|
switch_call_cause_t sofia_glue_sip_cause_to_freeswitch(int status);
|
|
|
|
void sofia_glue_do_xfer_invite(switch_core_session_t *session);
|
2007-04-30 16:26:44 +00:00
|
|
|
uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sip_t const *sip,
|
2008-05-21 21:49:27 +00:00
|
|
|
sofia_regtype_t regtype, char *key, uint32_t keylen, switch_event_t **v_event, const char *is_nat);
|
2007-06-20 07:15:53 +00:00
|
|
|
extern switch_endpoint_interface_t *sofia_endpoint_interface;
|
2007-04-13 22:15:58 +00:00
|
|
|
void sofia_presence_set_chat_hash(private_object_t *tech_pvt, sip_t const *sip);
|
2007-03-31 19:01:33 +00:00
|
|
|
switch_status_t sofia_on_hangup(switch_core_session_t *session);
|
|
|
|
char *sofia_glue_get_url_from_contact(char *buf, uint8_t to_dup);
|
|
|
|
void sofia_presence_set_hash_key(char *hash_key, int32_t len, sip_t const *sip);
|
2007-04-04 03:08:17 +00:00
|
|
|
void sofia_glue_sql_close(sofia_profile_t *profile);
|
|
|
|
int sofia_glue_init_sql(sofia_profile_t *profile);
|
2008-03-11 18:19:17 +00:00
|
|
|
char *sofia_overcome_sip_uri_weakness(switch_core_session_t *session, const char *uri, const sofia_transport_t transport, switch_bool_t uri_only, const char *params);
|
2007-04-04 03:08:17 +00:00
|
|
|
switch_bool_t sofia_glue_execute_sql_callback(sofia_profile_t *profile,
|
|
|
|
switch_bool_t master,
|
|
|
|
switch_mutex_t *mutex,
|
|
|
|
char *sql,
|
|
|
|
switch_core_db_callback_func_t callback,
|
|
|
|
void *pdata);
|
|
|
|
char *sofia_glue_execute_sql2str(sofia_profile_t *profile, switch_mutex_t *mutex, char *sql, char *resbuf, size_t len);
|
2007-04-19 21:40:50 +00:00
|
|
|
void sofia_glue_check_video_codecs(private_object_t *tech_pvt);
|
2007-04-30 20:35:35 +00:00
|
|
|
void sofia_glue_del_profile(sofia_profile_t *profile);
|
2007-05-03 01:55:25 +00:00
|
|
|
|
|
|
|
switch_status_t sofia_glue_add_profile(char *key, sofia_profile_t *profile);
|
|
|
|
void sofia_glue_release_profile__(const char *file, const char *func, int line, sofia_profile_t *profile);
|
|
|
|
#define sofia_glue_release_profile(x) sofia_glue_release_profile__(__FILE__, __SWITCH_FUNC__, __LINE__, x)
|
|
|
|
|
2008-07-22 22:23:50 +00:00
|
|
|
sofia_profile_t *sofia_glue_find_profile__(const char *file, const char *func, int line, const char *key);
|
2007-05-03 01:55:25 +00:00
|
|
|
#define sofia_glue_find_profile(x) sofia_glue_find_profile__(__FILE__, __SWITCH_FUNC__, __LINE__, x)
|
|
|
|
|
|
|
|
switch_status_t sofia_reg_add_gateway(char *key, sofia_gateway_t *gateway);
|
2008-07-17 14:32:01 +00:00
|
|
|
sofia_gateway_t *sofia_reg_find_gateway__(const char *file, const char *func, int line, const char *key);
|
2007-05-03 01:55:25 +00:00
|
|
|
#define sofia_reg_find_gateway(x) sofia_reg_find_gateway__(__FILE__, __SWITCH_FUNC__, __LINE__, x)
|
|
|
|
|
|
|
|
void sofia_reg_release_gateway__(const char *file, const char *func, int line, sofia_gateway_t *gateway);
|
|
|
|
#define sofia_reg_release_gateway(x) sofia_reg_release_gateway__(__FILE__, __SWITCH_FUNC__, __LINE__, x);
|
2007-11-10 00:47:09 +00:00
|
|
|
|
|
|
|
#define check_decode(_var, _session) do { \
|
|
|
|
assert(_session); \
|
|
|
|
if (!switch_strlen_zero(_var)) { \
|
|
|
|
int d = 0; \
|
|
|
|
char *p; \
|
|
|
|
if (strchr(_var, '%')) { \
|
|
|
|
char *tmp = switch_core_session_strdup(_session, _var); \
|
|
|
|
switch_url_decode(tmp); \
|
|
|
|
_var = tmp; \
|
|
|
|
d++; \
|
|
|
|
} \
|
|
|
|
if ((p = strchr(_var, '"'))) { \
|
|
|
|
if (!d) { \
|
|
|
|
char *tmp = switch_core_session_strdup(_session, _var); \
|
|
|
|
_var = tmp; \
|
|
|
|
} \
|
|
|
|
if ((p = strchr(_var, '"'))) { \
|
|
|
|
_var = p+1; \
|
|
|
|
} \
|
|
|
|
if ((p = strrchr(_var, '"'))) { \
|
|
|
|
*p = '\0'; \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
\
|
|
|
|
if(_session) break; \
|
|
|
|
} while(!_session)
|
2007-12-18 19:12:45 +00:00
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Transport handling helper functions
|
|
|
|
*/
|
|
|
|
sofia_transport_t sofia_glue_via2transport(const sip_via_t *via);
|
|
|
|
sofia_transport_t sofia_glue_url2transport(const url_t *url);
|
2008-01-17 17:37:49 +00:00
|
|
|
sofia_transport_t sofia_glue_str2transport(const char *str);
|
2007-12-18 19:12:45 +00:00
|
|
|
|
|
|
|
const char *sofia_glue_transport2str(const sofia_transport_t tp);
|
2008-01-17 17:37:49 +00:00
|
|
|
char * sofia_glue_find_parameter(const char *str, const char *param);
|
2007-12-18 19:12:45 +00:00
|
|
|
|
|
|
|
int sofia_glue_transport_has_tls(const sofia_transport_t tp);
|
2007-12-22 00:32:20 +00:00
|
|
|
const char *sofia_glue_get_unknown_header(sip_t const *sip, const char *name);
|
2008-01-16 06:01:53 +00:00
|
|
|
switch_status_t sofia_glue_build_crypto(private_object_t *tech_pvt, int index, switch_rtp_crypto_key_type_t type, switch_rtp_crypto_direction_t direction);
|
2008-02-21 17:48:41 +00:00
|
|
|
void sofia_glue_tech_patch_sdp(private_object_t *tech_pvt);
|
2008-02-22 15:27:40 +00:00
|
|
|
switch_status_t sofia_glue_tech_proxy_remote_addr(private_object_t *tech_pvt);
|
2008-03-14 03:46:54 +00:00
|
|
|
void sofia_presence_event_thread_start(void);
|
2008-07-17 20:47:42 +00:00
|
|
|
void sofia_reg_expire_call_id(sofia_profile_t *profile, const char *call_id, int reboot);
|
2008-05-23 19:41:23 +00:00
|
|
|
switch_status_t sofia_glue_tech_choose_video_port(private_object_t *tech_pvt, int force);
|
|
|
|
switch_status_t sofia_glue_tech_set_video_codec(private_object_t *tech_pvt, int force);
|
2008-06-27 23:34:33 +00:00
|
|
|
const char *sofia_glue_strip_proto(const char *uri);
|
2008-07-08 22:05:34 +00:00
|
|
|
switch_status_t reconfig_sofia(sofia_profile_t *profile);
|
|
|
|
void sofia_glue_del_gateway(sofia_gateway_t *gp);
|
2008-07-17 20:47:42 +00:00
|
|
|
void sofia_reg_send_reboot(sofia_profile_t *profile, const char *user, const char *host, const char *contact, const char *user_agent);
|
2008-07-22 22:23:50 +00:00
|
|
|
void sofia_glue_restart_all_profiles(void);
|