[Home]

Summary:ASTERISK-12806: SMS receive file name incorrect
Reporter:Alec Davis (alecdavis)Labels:
Date Opened:2008-10-01 15:06:28Date Closed:2008-10-08 13:58:30
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Applications/app_sms
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) 20081001__bug13595.diff.txt
Description:using dialplan code
  exten => s,n(SMSMessage),NoOp( SMS MESSAGE )
  exten => s,n,Answer()
  exten => s,n,Wait(2)
  exten => s,n,SMS(test,sat)
  exten => s,n,Hangup()

The above code succesfully collects the message, but the filename is wrong?
/var/spool/asterisk/sms/morx/test.1970-01-01T12:00:00-9
Comments:By: Tilghman Lesher (tilghman) 2008-10-01 15:32:08

Patch uploaded.  Needs testing.

By: Alec Davis (alecdavis) 2008-10-01 23:18:17

patch worked for both typo in sms help and received file name.

I also changed a few lines down in sms_writefile to be find the received file.

       o = fopen(fn, "w");
       if (o == NULL){
               ast_log(LOG_ERROR, "Unable to open file [%s]\n", fn);
               return;
       }else{
               ast_log(LOG_NOTICE, "[%s]\n", fn);
       }


Console output look likes this:
Notice the "ast_read_failed" at bottom. happens every time.

   -- Starting simple switch on 'DAHDI/63-1'
   -- Executing [s@cellular:1] NoOp("DAHDI/63-1", "Callerid = "" <042111>") in new stack
   -- Executing [s@cellular:2] GotoIf("DAHDI/63-1", "1?SMSMessage") in new stack
   -- Goto (cellular,s,5)
   -- Executing [s@cellular:5] NoOp("DAHDI/63-1", " SMS MESSAGE ") in new stack
   -- Executing [s@cellular:6] Answer("DAHDI/63-1", "") in new stack
   -- Executing [s@cellular:7] Wait("DAHDI/63-1", "0.5") in new stack
   -- Executing [s@cellular:8] SMS("DAHDI/63-1", "test,at") in new stack
sms argc 2 queue <test> opts <at> addr <> body <>
   -- SMS TX 7F 00
[Oct  2 17:18:25] NOTICE[3656]: app_sms.c:1690 sms_process: bad stop bit    -- SMS RX 11 3D 3B 00 10 01 00 00 11 06 00 00 00 00 00 00 00 12 03 00 00 00 00 13 0C 00 54 65 73 74...
   -- SMS-P2 ParASTERISK-6 [1]: 00
   -- SMS-P2 ParASTERISK-7 [6]: 00 00 00 00 00 00
   -- SMS-P2 ParASTERISK-8 [3]: 00 00 00
   -- SMS-P2 BodyASTERISK-9=[Test message]
   -- SMS-P2 DateASTERISK-10=530/538 545:546
   -- SMS-P2 OriginASTERISK-11=[#6421496XXX]
[Oct  2 17:18:26] NOTICE[3656]: app_sms.c:935 sms_writefile: [/var/spool/asterisk/sms/mtrx/.test.2008-10-02T17:18:26-1]
   -- SMS TX 15 06 04 00 1F 01 00 00
   -- SMS RX 17 00 E9
   -- SMS TX 15 00
[Oct  2 17:18:30] NOTICE[3656]: app_sms.c:1913 sms_exec: ast_read failed
   -- Hungup 'DAHDI/63-1'

The actual file received doesn't however have a leading '.'

Thanks Alec

By: Alec Davis (alecdavis) 2008-10-01 23:34:07

The problem I mentioned above regarding ast_read_failed causes the dialplan to end execution, thus not processing the received file. This has been happening before any patches were applied.

You don't get to see priority step "NoOp(About to Send as Email)"

dialplan code:

 exten => s,n,Answer()
 exten => s,n,Wait(0.5)
 exten => s,n,SMS(test,at)
 exten => s,n,NoOp(About to Send as Email)
 exten => s,n,System(/usr/lib/asterisk/sms-email)
 exten => s,n,NoOp(Finished)
 exten => s,n,Hangup()

console output:
   -- Starting simple switch on 'DAHDI/63-1'
   -- Executing [s@cellular:1] NoOp("DAHDI/63-1", "Callerid = "" <042111>") in new stack
   -- Executing [s@cellular:2] GotoIf("DAHDI/63-1", "1?SMSMessage") in new stack
   -- Goto (cellular,s,5)
   -- Executing [s@cellular:5] NoOp("DAHDI/63-1", " SMS MESSAGE ") in new stack
   -- Executing [s@cellular:6] Answer("DAHDI/63-1", "") in new stack
   -- Executing [s@cellular:7] Wait("DAHDI/63-1", "0.5") in new stack
   -- Executing [s@cellular:8] SMS("DAHDI/63-1", "test,at") in new stack
sms argc 2 queue <test> opts <at> addr <> body <>
   -- SMS TX 7F 00
[Oct  2 17:37:55] NOTICE[3672]: app_sms.c:1690 sms_process: bad stop bit    -- SMS RX 11 34 32 00 10 01 00 00 11 06 00 00 00 00 00 00 00 12 03 00 00 00 00 13 03 00 41 64 67 14...
   -- SMS-P2 ParASTERISK-6 [1]: 00
   -- SMS-P2 ParASTERISK-7 [6]: 00 00 00 00 00 00
   -- SMS-P2 ParASTERISK-8 [3]: 00 00 00
   -- SMS-P2 BodyASTERISK-9=[Adg]
   -- SMS-P2 DateASTERISK-10=530/538 545:565
   -- SMS-P2 OriginASTERISK-11=[#6421496XXX]        (modified by me)
[Oct  2 17:37:56] NOTICE[3672]: app_sms.c:935 sms_writefile: [/var/spool/asterisk/sms/mtrx/.test.2008-10-02T17:37:56-2]
   -- SMS TX 15 06 04 00 1F 01 00 00
   -- SMS RX 17 00 E9
   -- SMS TX 15 00
[Oct  2 17:38:00] NOTICE[3672]: app_sms.c:1913 sms_exec: ast_read failed
   -- Hungup 'DAHDI/63-1'
astrid*CLI>

By: Tilghman Lesher (tilghman) 2008-10-08 09:53:10

alecdavis: That's because when ast_read fails, it signals that the channel has ended and is ready to be hungup.  What you really want to do here is execute your other steps in the "h" extension, as that extension path is followed when a hangup signal is received.

By: Alec Davis (alecdavis) 2008-10-08 13:44:20

this can be closed.
I had realised I needed to use the "h" extension, working well.

Thanks Alec

By: Digium Subversion (svnbot) 2008-10-08 13:58:25

Repository: asterisk
Revision: 147592

U   trunk/apps/app_sms.c

------------------------------------------------------------------------
r147592 | tilghman | 2008-10-08 13:58:18 -0500 (Wed, 08 Oct 2008) | 8 lines

Correct a typo in the help; also, ensure that the date and time are correctly
set, if not specified in the message.
(Closes issue ASTERISK-12805, closes issue ASTERISK-12806)
Reported by: alecdavis
Patches:
      20081001__bug13595.diff.txt uploaded by Corydon76 (license 14)
Tested by: alecdavis

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=147592