Add find hlr check, fix compile errors

This commit is contained in:
gardners 2011-05-24 07:22:43 +09:30 committed by Jeremy Lakeman
parent ad53f85f8f
commit 803def3633
2 changed files with 12 additions and 7 deletions

View File

@ -343,6 +343,8 @@ int fixResponses(struct response_set *responses);
int importHlr(char *textfile); int importHlr(char *textfile);
int exportHlr(unsigned char *hlr,char *text); int exportHlr(unsigned char *hlr,char *text);
int openHlrFile(char *backing_file,int size); int openHlrFile(char *backing_file,int size);
int runCommand(char *cmd);
int asteriskObtainGateway(char *requestor_sid,char *did,char *uri_out);
#define CRYPT_CIPHERED 1 #define CRYPT_CIPHERED 1
#define CRYPT_SIGNED 2 #define CRYPT_SIGNED 2

View File

@ -214,12 +214,15 @@ int processRequest(unsigned char *packet,int len,
pofs+=messageLen; pofs+=messageLen;
// Check if I'm the recipient // Check if I'm the recipient
ofs=0;
// Send SMS to android if (findHlr(hlr, &ofs, sid, did)){
char amCommand[576]; // 64 char + 2*256(max) char = 576 // Send SMS to android
sprintf(amCommand, "am broadcast -a org.servalproject.DT -e number \"%s\" -e content \"%s\"", emitterPhoneNumber, message); char amCommand[576]; // 64 char + 2*256(max) char = 576
if (debug>1) fprintf(stderr,"Delivering DT message via intent: %s\n",amCommand); sprintf(amCommand, "am broadcast -a org.servalproject.DT -e number \"%s\" -e content \"%s\"", emitterPhoneNumber, message);
int exitcode = runCommand(amCommand); if (debug>1) fprintf(stderr,"Delivering DT message via intent: %s\n",amCommand);
int exitcode = runCommand(amCommand);
respondSimple(sid,ACTION_OKAY,NULL,0,transaction_id,CRYPT_CIPHERED|CRYPT_SIGNED);
}
} }
break; break;
case ACTION_SET: case ACTION_SET:
@ -401,7 +404,7 @@ int processRequest(unsigned char *packet,int len,
ask asterisk to re-read extensions.conf, and then make sure it has ask asterisk to re-read extensions.conf, and then make sure it has
a functional SIP gateway. a functional SIP gateway.
*/ */
if (!asteriskObtainGateway(sid,did,uri)) if (!asteriskObtainGateway(sid,did,(char *)uri))
{ {
fake.value_len=strlen((char *)uri); fake.value_len=strlen((char *)uri);