[asterisk-commits] mmichelson: branch group/CCSS r236789 - /team/group/CCSS/channels/chan_sip.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Dec 29 11:12:43 CST 2009
Author: mmichelson
Date: Tue Dec 29 11:12:39 2009
New Revision: 236789
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=236789
Log:
Convert the monitor_instance to use string fields and add a new
peername stringfield.
The stringfield change makes sense because it could potentially save
a bit of space and the strings will likely only be set once or twice
during a typical CC transaction.
The peername part is being added as a means of finding a specific
sip_monitor_instance. When it comes time to transmit a SUBSCRIBE or
PUBLISH having to do with CC, we'll need to send to the appropriate
URI, but we'll need to get address information based on the peer with
which that URI is associated.
Modified:
team/group/CCSS/channels/chan_sip.c
Modified: team/group/CCSS/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS/channels/chan_sip.c?view=diff&rev=236789&r1=236788&r2=236789
==============================================================================
--- team/group/CCSS/channels/chan_sip.c (original)
+++ team/group/CCSS/channels/chan_sip.c Tue Dec 29 11:12:39 2009
@@ -3591,12 +3591,15 @@
struct ao2_container *sip_monitor_instances;
struct sip_monitor_instance {
+ AST_DECLARE_STRING_FIELDS(
+ AST_STRING_FIELD(subscribe_uri);
+ AST_STRING_FIELD(notify_uri);
+ AST_STRING_FIELD(peername);
+ );
struct ast_cc_monitor *monitor;
int core_id;
struct sip_pvt *subscription_pvt;
struct sip_epa_entry *suspension_entry;
- char subscribe_uri[SIPBUFSIZE];
- char notify_uri[SIPBUFSIZE];
};
static int sip_monitor_instance_hash_fn(const void *obj, const int flags)
@@ -3625,6 +3628,7 @@
if (monitor_instance->monitor) {
ao2_ref(monitor_instance->monitor, -1);
}
+ ast_string_field_free_memory(monitor_instance);
}
static struct sip_monitor_instance *sip_monitor_instance_init(int core_id, const char * const subscribe_uri)
@@ -3635,7 +3639,12 @@
return NULL;
}
- ast_copy_string(monitor_instance->subscribe_uri, subscribe_uri, sizeof(monitor_instance->subscribe_uri));
+ if (ast_string_field_init(monitor_instance, 256)) {
+ ao2_ref(monitor_instance, -1);
+ return NULL;
+ }
+
+ ast_string_field_set(monitor_instance, subscribe_uri, subscribe_uri);
monitor_instance->core_id = core_id;
ao2_link(sip_monitor_instances, monitor_instance);
return monitor_instance;
@@ -21315,7 +21324,7 @@
uri = get_in_brackets((char *)get_header(req, "From"));
}
- ast_copy_string(monitor_instance->notify_uri, uri, sizeof(monitor_instance->notify_uri));
+ ast_string_field_set(monitor_instance, notify_uri, uri);
ast_cc_monitor_callee_available(monitor_instance->monitor);
ao2_ref(monitor_instance, -1);
transmit_response(pvt, "200 OK", req);
More information about the asterisk-commits
mailing list