aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2004-12-19 17:16:39 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2004-12-19 17:16:39 +0000
commit62d1e370abe29aae5e494f2b24468980ec64c361 (patch)
tree553581ea974ccb2620756ccfae428d71791f755f
parentbf9ad997ffd69040efec0d526af1a1e20751f53c (diff)
SMS fix, pbx optimization (bug #3098)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@4482 f38db490-d61c-443f-a65b-d21fe96a405b
-rwxr-xr-xapps/app_sms.c9
-rwxr-xr-xpbx.c10
2 files changed, 12 insertions, 7 deletions
diff --git a/apps/app_sms.c b/apps/app_sms.c
index 42412ddf5..272b3b934 100755
--- a/apps/app_sms.c
+++ b/apps/app_sms.c
@@ -38,7 +38,7 @@
/* user ref field */
static volatile unsigned char message_ref; /* arbitary message ref */
-static volatile unsigned int seq; /* arbitrary message sequence number for unqiue files */
+static volatile unsigned int seq; /* arbitrary message sequence number for unqiue files */
static char log_file[255];
static char spool_dir[255];
@@ -108,6 +108,7 @@ static const unsigned short escapes[] = {
typedef struct sms_s
{
unsigned char hangup; /* we are done... */
+ unsigned char err; /* set for any errors */
unsigned char smsc:1; /* we are SMSC */
unsigned char rx:1; /* this is a received message */
char queue[30]; /* queue name */
@@ -1200,6 +1201,7 @@ sms_messagerx (sms_t * h)
}
break;
case 0x92: /* SMS_ERROR */
+ h->err = 1;
sms_messagetx (h); /* send whatever we sent again */
break;
case 0x93: /* SMS_EST */
@@ -1213,6 +1215,7 @@ sms_messagerx (sms_t * h)
sms_nextoutgoing (h);
break;
case 0x96: /* SMS_NACK */
+ h->err = 1;
sms_log (h, 'N');
sms_nextoutgoing (h);
break;
@@ -1429,9 +1432,11 @@ sms_process (sms_t * h, int samples, signed short *data)
{ /* nothing happening */
ast_log (LOG_EVENT, "No data, hanging up\n");
h->hangup = 1;
+ h->err = 1;
}
if (h->ierr)
{ /* error */
+ h->err = 1;
h->omsg[0] = 0x92; /* error */
h->omsg[1] = 1;
h->omsg[2] = h->ierr;
@@ -1608,7 +1613,7 @@ sms_exec (struct ast_channel *chan, void *data)
sms_log (&h, '?'); /* log incomplete message */
LOCAL_USER_REMOVE (u);
- return (h.hangup);
+ return (h.err);
}
int
diff --git a/pbx.c b/pbx.c
index 09a87d2d0..999a765cb 100755
--- a/pbx.c
+++ b/pbx.c
@@ -3925,7 +3925,7 @@ int ast_async_goto_by_name(const char *channame, const char *context, const char
return res;
}
-static void ext_strncpy(char *dst, const char *src, int len)
+static int ext_strncpy(char *dst, const char *src, int len)
{
int count=0;
@@ -3944,6 +3944,8 @@ static void ext_strncpy(char *dst, const char *src, int len)
count++;
}
*dst = '\0';
+
+ return count;
}
/*
@@ -4002,13 +4004,11 @@ int ast_add_extension2(struct ast_context *con,
p += strlen(label) + 1;
}
tmp->exten = p;
- ext_strncpy(tmp->exten, extension, strlen(extension) + 1);
- p += strlen(extension) + 1;
+ p += ext_strncpy(tmp->exten, extension, strlen(extension) + 1) + 1;
tmp->priority = priority;
tmp->cidmatch = p;
if (callerid) {
- ext_strncpy(tmp->cidmatch, callerid, strlen(callerid) + 1);
- p += strlen(callerid) + 1;
+ p += ext_strncpy(tmp->cidmatch, callerid, strlen(callerid) + 1) + 1;
tmp->matchcid = 1;
} else {
tmp->cidmatch[0] = '\0';