diff --git a/libs/apr/include/apr_network_io.h b/libs/apr/include/apr_network_io.h index 24708c55ae..1d65f1cb09 100644 --- a/libs/apr/include/apr_network_io.h +++ b/libs/apr/include/apr_network_io.h @@ -631,6 +631,13 @@ APR_DECLARE(apr_status_t) apr_socket_timeout_set(apr_socket_t *sock, APR_DECLARE(apr_status_t) apr_socket_opt_get(apr_socket_t *sock, apr_int32_t opt, apr_int32_t *on); +/** + * Get Socket fd for the socket passed + * @param sock The socket to quesry for the socket fd + */ +APR_DECLARE(int) apr_socket_fd_get(apr_socket_t *sock); + + /** * Query socket timeout for the specified socket * @param sock The socket to query diff --git a/libs/apr/network_io/os2/sockopt.c b/libs/apr/network_io/os2/sockopt.c index 101a952d98..85ff35331a 100644 --- a/libs/apr/network_io/os2/sockopt.c +++ b/libs/apr/network_io/os2/sockopt.c @@ -110,6 +110,16 @@ APR_DECLARE(apr_status_t) apr_socket_opt_get(apr_socket_t *sock, } +APR_DECLARE(int) apr_socket_fd_get(apr_socket_t *sock) +{ + if (sock) { + return sock->socketdes; + } else { + return 0; + } +} + + APR_DECLARE(apr_status_t) apr_socket_atmark(apr_socket_t *sock, int *atmark) { int oobmark; diff --git a/libs/apr/network_io/unix/sockopt.c b/libs/apr/network_io/unix/sockopt.c index 3fc932f42f..344b0484b4 100644 --- a/libs/apr/network_io/unix/sockopt.c +++ b/libs/apr/network_io/unix/sockopt.c @@ -344,6 +344,16 @@ apr_status_t apr_socket_opt_get(apr_socket_t *sock, } +int apr_socket_fd_get(apr_socket_t *sock) +{ + if (sock) { + return sock->socketdes; + } else { + return 0; + } +} + + apr_status_t apr_socket_atmark(apr_socket_t *sock, int *atmark) { #ifndef BEOS_R5 diff --git a/libs/apr/network_io/win32/sockopt.c b/libs/apr/network_io/win32/sockopt.c index c8e670fa79..05ba19c9b8 100644 --- a/libs/apr/network_io/win32/sockopt.c +++ b/libs/apr/network_io/win32/sockopt.c @@ -244,6 +244,16 @@ APR_DECLARE(apr_status_t) apr_socket_opt_get(apr_socket_t *sock, } +APR_DECLARE(int) apr_socket_fd_get(apr_socket_t *sock) +{ + if (sock) { + return sock->socketdes; + } else { + return 0; + } +} + + APR_DECLARE(apr_status_t) apr_socket_atmark(apr_socket_t *sock, int *atmark) { u_long oobmark; diff --git a/src/include/switch_apr.h b/src/include/switch_apr.h index 5ab5d35e7e..82a25f3b00 100644 --- a/src/include/switch_apr.h +++ b/src/include/switch_apr.h @@ -1103,6 +1103,12 @@ SWITCH_DECLARE(switch_status_t) switch_socket_accept(switch_socket_t ** new_sock */ SWITCH_DECLARE(switch_status_t) switch_socket_connect(switch_socket_t *sock, switch_sockaddr_t *sa); +/** + * Get socket fd for the switch socket passed + * @param sock The socket we wish to have fd + */ +SWITCH_DECLARE(int) switch_socket_fd_get(switch_socket_t *sock); + SWITCH_DECLARE(uint16_t) switch_sockaddr_get_port(switch_sockaddr_t *sa); SWITCH_DECLARE(const char *) switch_get_addr(char *buf, switch_size_t len, switch_sockaddr_t *in); SWITCH_DECLARE(switch_status_t) switch_getnameinfo(char **hostname, switch_sockaddr_t *sa, int32_t flags); diff --git a/src/include/switch_core.h b/src/include/switch_core.h index 7a0a0e49ad..86763f9713 100644 --- a/src/include/switch_core.h +++ b/src/include/switch_core.h @@ -2654,6 +2654,19 @@ SWITCH_DECLARE(switch_status_t) switch_core_del_registration(const char *user, c */ SWITCH_DECLARE(switch_status_t) switch_core_expire_registration(int force); +/*! + \brief Get RTP port range start value + \param[in] void + \param[out] RTP port range start value +*/ +SWITCH_DECLARE(uint16_t) switch_core_get_rtp_port_range_start_port(void); + +/*! + \brief Get RTP port range end value + \param[in] void + \param[out] RTP port range end value +*/ +SWITCH_DECLARE(uint16_t) switch_core_get_rtp_port_range_end_port(void); SWITCH_DECLARE(char *) switch_say_file_handle_get_variable(switch_say_file_handle_t *sh, const char *var); SWITCH_DECLARE(char *) switch_say_file_handle_get_path(switch_say_file_handle_t *sh); diff --git a/src/include/switch_types.h b/src/include/switch_types.h index b8da675996..e4f08f832f 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -1049,6 +1049,7 @@ typedef enum { SWITCH_MESSAGE_INDICATE_UNBRIDGE, SWITCH_MESSAGE_INDICATE_TRANSFER, SWITCH_MESSAGE_INDICATE_RINGING, + SWITCH_MESSAGE_INDICATE_ALERTING, SWITCH_MESSAGE_INDICATE_MEDIA, SWITCH_MESSAGE_INDICATE_3P_MEDIA, SWITCH_MESSAGE_INDICATE_NOMEDIA, diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 8486b96c4a..32a86e502c 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -2133,6 +2133,20 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi } } break; + case SWITCH_MESSAGE_INDICATE_ALERTING: + { + char *extra_header = sofia_glue_get_extra_headers(channel, SOFIA_SIP_PROGRESS_HEADER_PREFIX); + const char *call_info = switch_channel_get_variable(channel, "presence_call_info_full"); + char *cid = generate_pai_str(tech_pvt); + nua_respond(tech_pvt->nh, SIP_180_RINGING, + SIPTAG_CONTACT_STR(tech_pvt->reply_contact), + TAG_IF(cid, SIPTAG_HEADER_STR(cid)), + TAG_IF(call_info, SIPTAG_CALL_INFO_STR(call_info)), + TAG_IF(!zstr(extra_header), SIPTAG_HEADER_STR(extra_header)), + TAG_IF(switch_stristr("update_display", tech_pvt->x_freeswitch_support_remote), + SIPTAG_HEADER_STR("X-FS-Support: " FREESWITCH_SUPPORT)), TAG_END()); + } + break; case SWITCH_MESSAGE_INDICATE_RINGING: { switch_ring_ready_t ring_ready_val = msg->numeric_arg; diff --git a/src/switch_apr.c b/src/switch_apr.c index db226cb6a8..c0ae265037 100644 --- a/src/switch_apr.c +++ b/src/switch_apr.c @@ -908,6 +908,11 @@ SWITCH_DECLARE(const char *) switch_get_addr(char *buf, switch_size_t len, switc return buf; } +SWITCH_DECLARE(int) switch_socket_fd_get(switch_socket_t *sock) +{ + return apr_socket_fd_get(sock); +} + SWITCH_DECLARE(uint16_t) switch_sockaddr_get_port(switch_sockaddr_t *sa) { return sa->port; diff --git a/src/switch_core.c b/src/switch_core.c index 67d35608c4..4a8865612b 100644 --- a/src/switch_core.c +++ b/src/switch_core.c @@ -3281,6 +3281,28 @@ SWITCH_DECLARE(int) switch_stream_system(const char *cmd, switch_stream_handle_t } +SWITCH_DECLARE(uint16_t) switch_core_get_rtp_port_range_start_port() +{ + uint16_t start_port = 0; + + /* By default pass rtp port range start value as zero in order to get actual + * RTP port range start value as configured */ + start_port = (uint16_t)switch_rtp_set_start_port((switch_port_t)start_port); + + return start_port; +} + +SWITCH_DECLARE(uint16_t) switch_core_get_rtp_port_range_end_port() +{ + uint16_t end_port = 0; + + /* By default pass rtp port range end value as zero in order to get actual + * RTP port range end value as configured */ + end_port = (uint16_t)switch_rtp_set_end_port((switch_port_t)end_port); + + return end_port; +} + /* For Emacs: * Local Variables: * mode:c