[asterisk-commits] mmichelson: branch mmichelson/caller_id r384958 - in /team/mmichelson/caller_...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Apr 8 11:19:21 CDT 2013
Author: mmichelson
Date: Mon Apr 8 11:19:17 2013
New Revision: 384958
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=384958
Log:
Address Josh and snuffy's review comments.
* Put proper dependencies on res_sip_callerid
* Reordered declarations in some functions
* Added blank lines between declarations and other code.
* Removed a red blob.
* Added documentation for session supplement priorities.
* Changed the priority in a session supplement from an int to the enum type.
* Switched to getting the effective connected ID of a channel when sending responses.
Modified:
team/mmichelson/caller_id/include/asterisk/res_sip_session.h
team/mmichelson/caller_id/res/res_sip_caller_id.c
Modified: team/mmichelson/caller_id/include/asterisk/res_sip_session.h
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/caller_id/include/asterisk/res_sip_session.h?view=diff&rev=384958&r1=384957&r2=384958
==============================================================================
--- team/mmichelson/caller_id/include/asterisk/res_sip_session.h (original)
+++ team/mmichelson/caller_id/include/asterisk/res_sip_session.h Mon Apr 8 11:19:17 2013
@@ -107,8 +107,14 @@
typedef int (*ast_sip_session_response_cb)(struct ast_sip_session *session, pjsip_rx_data *rdata);
enum ast_sip_session_supplement_priority {
+ /*! Top priority. Supplements with this priority are those that need to run before any others */
AST_SIP_SESSION_SUPPLEMENT_PRIORITY_FIRST = 0,
+ /*! Channel creation priority.
+ * chan_gulp creates a channel at this priority. If your supplement depends on being run before
+ * or after channel creation, then set your priority to be lower or higher than this value.
+ */
AST_SIP_SESSION_SUPPLEMENT_PRIORITY_CHANNEL = 1000000,
+ /*! Lowest priority. Supplements with this priority should be run after all other supplements */
AST_SIP_SESSION_SUPPLEMENT_PRIORITY_LAST = INT_MAX,
};
@@ -122,7 +128,7 @@
/*! Method on which to call the callbacks. If NULL, call on all methods */
const char *method;
/*! Priority for this supplement. Lower numbers are visited before higher numbers */
- int priority;
+ enum ast_sip_session_supplement_priority priority;
/*!
* \brief Notification that the session has begun
* This method will always be called from a SIP servant thread.
Modified: team/mmichelson/caller_id/res/res_sip_caller_id.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/caller_id/res/res_sip_caller_id.c?view=diff&rev=384958&r1=384957&r2=384958
==============================================================================
--- team/mmichelson/caller_id/res/res_sip_caller_id.c (original)
+++ team/mmichelson/caller_id/res/res_sip_caller_id.c Mon Apr 8 11:19:17 2013
@@ -18,6 +18,8 @@
/*** MODULEINFO
<depend>pjproject</depend>
+ <depend>res_sip</depend>
+ <depend>res_sip_session</depend>
<support_level>core</support_level>
***/
@@ -77,11 +79,11 @@
static pjsip_fromto_hdr *get_id_header(pjsip_rx_data *rdata, const pj_str_t *header_name)
{
static const pj_str_t from = { "From", 4 };
+ pj_str_t header_content;
+ pjsip_fromto_hdr *parsed_hdr;
pjsip_generic_string_hdr *ident = pjsip_msg_find_hdr_by_name(rdata->msg_info.msg,
header_name, NULL);
- pjsip_fromto_hdr *parsed_hdr;
int parsed_len;
- pj_str_t header_content;
if (!ident) {
return NULL;
@@ -117,6 +119,7 @@
static const pj_str_t privacy_str = { "Privacy", 7 };
pjsip_fromto_hdr *pai_hdr = get_id_header(rdata, &pai_str);
pjsip_generic_string_hdr *privacy;
+
if (!pai_hdr) {
return -1;
}
@@ -159,6 +162,7 @@
pjsip_fromto_hdr *rpid_hdr = get_id_header(rdata, &rpid_str);
pjsip_param *screen;
pjsip_param *privacy;
+
if (!rpid_hdr) {
return -1;
}
@@ -278,6 +282,7 @@
{
struct ast_party_connected_line connected;
struct ast_set_party_connected_line update_connected;
+
ast_party_connected_line_init(&connected);
ast_party_id_copy(&connected.id, id);
@@ -307,6 +312,7 @@
static void update_incoming_connected_line(struct ast_sip_session *session, pjsip_rx_data *rdata)
{
struct ast_party_id id;
+
if (!session->endpoint->trust_id_inbound) {
return;
}
@@ -341,7 +347,7 @@
if (session->endpoint->trust_id_inbound &&
(!set_id_from_pai(rdata, &session->id) || !set_id_from_rpid(rdata, &session->id))) {
return 0;
- }
+ }
ast_party_id_copy(&session->id, &session->endpoint->id);
if (!session->endpoint->id.number.valid) {
set_id_from_from(rdata, &session->id);
@@ -633,6 +639,7 @@
static void caller_id_outgoing_request(struct ast_sip_session *session, pjsip_tx_data *tdata)
{
struct ast_party_id connected_id;
+
if (!session->channel) {
return;
}
@@ -671,10 +678,13 @@
*/
static void caller_id_outgoing_response(struct ast_sip_session *session, pjsip_tx_data *tdata)
{
+ struct ast_party_id connected_id;
+
if (!session->channel) {
return;
}
- add_id_headers(session, tdata, &ast_channel_connected(session->channel)->id);
+ connected_id = ast_channel_connected_effective_id(session->channel);
+ add_id_headers(session, tdata, &connected_id);
}
static struct ast_sip_session_supplement caller_id_supplement = {
More information about the asterisk-commits
mailing list