SMS fix, pbx optimization (bug #3098)

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@4482 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Mark Spencer 2004-12-19 17:16:39 +00:00
parent 933f3a22f4
commit 374c9c1789
2 changed files with 12 additions and 7 deletions

View File

@ -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

10
pbx.c
View File

@ -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';