summaryrefslogtreecommitdiff
path: root/net/asterisk14/files/patch-channels::chan_sip.c
diff options
context:
space:
mode:
authorMaxim Sobolev <sobomax@FreeBSD.org>2004-04-30 05:21:08 +0000
committerMaxim Sobolev <sobomax@FreeBSD.org>2004-04-30 05:21:08 +0000
commit962d6e05b40940170ea394def1103b4e065949bc (patch)
treee7bd91f082e901686aaa1a463f931bf3099c4f07 /net/asterisk14/files/patch-channels::chan_sip.c
parentAdd kscope-0.6, a KDE-based front-end to cscope/ctags. It has multiple (diff)
- Update to 0.9.0;
- add optional support for building with Zaptel module.
Notes
Notes: svn path=/head/; revision=107998
Diffstat (limited to 'net/asterisk14/files/patch-channels::chan_sip.c')
-rw-r--r--net/asterisk14/files/patch-channels::chan_sip.c120
1 files changed, 120 insertions, 0 deletions
diff --git a/net/asterisk14/files/patch-channels::chan_sip.c b/net/asterisk14/files/patch-channels::chan_sip.c
new file mode 100644
index 000000000000..b98f9d185009
--- /dev/null
+++ b/net/asterisk14/files/patch-channels::chan_sip.c
@@ -0,0 +1,120 @@
+
+$FreeBSD$
+
+--- channels/chan_sip.c.orig Wed Jan 14 08:10:53 2004
++++ channels/chan_sip.c Fri Jan 30 01:47:34 2004
+@@ -124,7 +124,7 @@
+ static int restart_monitor(void);
+
+ /* Codecs that we support by default: */
+-static int capability = AST_FORMAT_ULAW | AST_FORMAT_ALAW | AST_FORMAT_GSM | AST_FORMAT_H263;
++static int capability = AST_FORMAT_ULAW | AST_FORMAT_ALAW | AST_FORMAT_GSM | AST_FORMAT_H263 | AST_FORMAT_G723_1 | AST_FORMAT_G729A;
+ static int noncodeccapability = AST_RTP_DTMF;
+
+ static char ourhost[256];
+@@ -176,6 +176,7 @@
+ struct sip_route {
+ struct sip_route *next;
+ char hop[0];
++ int lr;
+ };
+
+ static struct sip_pvt {
+@@ -3417,6 +3418,10 @@
+ /* Make a struct route */
+ thishop = (struct sip_route *)malloc(sizeof(struct sip_route)+len+1);
+ if (thishop) {
++ if (strnstr(rr, ";lr", len) != NULL)
++ thishop->lr = 1;
++ else
++ thishop->lr = 0;
+ strncpy(thishop->hop, rr, len);
+ thishop->hop[len] = '\0';
+ ast_log(LOG_DEBUG, "build_route: Record-Route hop: <%s>\n", thishop->hop);
+@@ -3440,31 +3445,41 @@
+ rr += len+1;
+ }
+ }
+- /* 2nd append the Contact: if there is one */
+- /* Can be multiple Contact headers, comma separated values - we just take the first */
+- contact = get_header(req, "Contact");
+- if (strlen(contact)) {
+- ast_log(LOG_DEBUG, "build_route: Contact hop: %s\n", contact);
+- /* Look for <: delimited address */
+- c = strchr(contact, '<');
+- if (c) {
+- /* Take to > */
+- ++c;
+- len = strcspn(c, ">");
+- } else {
+- /* No <> - just take the lot */
+- c = contact; len = strlen(contact);
+- }
+- thishop = (struct sip_route *)malloc(sizeof(struct sip_route)+len+1);
++ /* Duplicate first route from the list */
++ if (head && head->lr) {
++ thishop = (struct sip_route *)malloc(sizeof(struct sip_route)+strlen(head->hop)+1);
+ if (thishop) {
+- strncpy(thishop->hop, c, len);
+- thishop->hop[len] = '\0';
+- thishop->next = NULL;
+- /* Goes at the end */
+- if (tail)
+- tail->next = thishop;
+- else
+- head = thishop;
++ memcpy(thishop, head, sizeof(struct sip_route)+strlen(head->hop)+1);
++ thishop->next = head;
++ head = thishop;
++ }
++ } else {
++ /* Append the Contact: if there is one and first route is w/o `lr' param */
++ /* Can be multiple Contact headers, comma separated values - we just take the first */
++ contact = get_header(req, "Contact");
++ if (strlen(contact)) {
++ ast_log(LOG_DEBUG, "build_route: Contact hop: %s\n", contact);
++ /* Look for <: delimited address */
++ c = strchr(contact, '<');
++ if (c) {
++ /* Take to > */
++ ++c;
++ len = strcspn(c, ">");
++ } else {
++ /* No <> - just take the lot */
++ c = contact; len = strlen(contact);
++ }
++ thishop = (struct sip_route *)malloc(sizeof(struct sip_route)+len+1);
++ if (thishop) {
++ strncpy(thishop->hop, c, len);
++ thishop->hop[len] = '\0';
++ thishop->next = NULL;
++ /* Goes at the end */
++ if (tail)
++ tail->next = thishop;
++ else
++ head = thishop;
++ }
+ }
+ }
+ /* Store as new route */
+@@ -5143,7 +5158,11 @@
+ /* Get destination right away */
+ gotdest = get_destination(p, NULL);
+ get_rdnis(p, NULL);
+- extract_uri(p, req);
++ build_route(p, req, 0);
++ if (!p->route->lr)
++ strncpy(p->uri, p->route->hop, sizeof(p->uri) - 1);
++ else
++ extract_uri(p, req);
+ build_contact(p);
+
+ if (gotdest) {
+@@ -5165,7 +5184,6 @@
+ c = sip_new(p, AST_STATE_DOWN, strlen(p->username) ? p->username : NULL);
+ *recount = 1;
+ /* Save Record-Route for any later requests we make on this dialogue */
+- build_route(p, req, 0);
+ if (c) {
+ /* Pre-lock the call */
+ ast_mutex_lock(&c->lock);