summaryrefslogtreecommitdiff
path: root/res/res_sip_endpoint_identifier_constant.c
diff options
context:
space:
mode:
authorMark Michelson <mmichelson@digium.com>2013-04-25 18:25:31 +0000
committerMark Michelson <mmichelson@digium.com>2013-04-25 18:25:31 +0000
commit74f2318051ca04c240d3b111397365837fb618b6 (patch)
treeef7ddfc3ce21969c93a5e4ab8adf60b12df2f4d9 /res/res_sip_endpoint_identifier_constant.c
parentb4c881c86ec8f823dba15bb69eb2cb9f3c7aeb88 (diff)
Merge the pimp_my_sip branch into trunk.
The pimp_my_sip branch is being merged at this point because it offers basic functionality, and from an API standpoint, things are complete. SIP work is *not* feature-complete; however, with the completion of the SUBSCRIBE/NOTIFY API, all APIs (except a PUBLISH API) have been created, and thus it is possible for developers to attempt to create new SIP work. API documentation can be found in the doxygen in the code, but usability documentation is still lacking. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@386540 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res/res_sip_endpoint_identifier_constant.c')
-rw-r--r--res/res_sip_endpoint_identifier_constant.c67
1 files changed, 67 insertions, 0 deletions
diff --git a/res/res_sip_endpoint_identifier_constant.c b/res/res_sip_endpoint_identifier_constant.c
new file mode 100644
index 000000000..e519a9ee8
--- /dev/null
+++ b/res/res_sip_endpoint_identifier_constant.c
@@ -0,0 +1,67 @@
+/*
+ * Asterisk -- An open source telephony toolkit.
+ *
+ * Copyright (C) 2013, Digium, Inc.
+ *
+ * Mark Michelson <mmichelson@digium.com>
+ *
+ * Includes code and algorithms from the Zapata library.
+ *
+ * See http://www.asterisk.org for more information about
+ * the Asterisk project. Please do not directly contact
+ * any of the maintainers of this project for assistance;
+ * the project provides a web site, mailing lists and IRC
+ * channels for your use.
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License Version 2. See the LICENSE file
+ * at the top of the source tree.
+ */
+
+/*** MODULEINFO
+ <depend>pjproject</depend>
+ <defaultenabled>no</defaultenabled>
+ <support_level>core</support_level>
+ ***/
+
+#include "asterisk.h"
+
+#include <pjsip.h>
+
+#include "asterisk/res_sip.h"
+#include "asterisk/module.h"
+
+static struct ast_sip_endpoint *constant_identify(pjsip_rx_data *rdata)
+{
+ /* This endpoint identifier always returns the same endpoint. It's used
+ * simply for testing. It allocates an endpoint from sorcery so default values
+ * do get applied.
+ */
+ struct ast_sip_endpoint *endpoint = ast_sorcery_alloc(ast_sip_get_sorcery(), "endpoint", NULL);
+ if (!endpoint) {
+ return NULL;
+ }
+ ast_parse_allow_disallow(&endpoint->prefs, endpoint->codecs, "ulaw", 1);
+ return endpoint;
+}
+
+static struct ast_sip_endpoint_identifier constant_identifier = {
+ .identify_endpoint = constant_identify,
+};
+
+static int load_module(void)
+{
+ ast_sip_register_endpoint_identifier(&constant_identifier);
+ return AST_MODULE_LOAD_SUCCESS;
+}
+
+static int unload_module(void)
+{
+ return 0;
+}
+
+AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_LOAD_ORDER, "SIP Constant Endpoint Identifier",
+ .load = load_module,
+ .unload = unload_module,
+ .load_pri = AST_MODPRI_APP_DEPEND,
+ );