Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unhandled PID value, only SMS supported #53

Closed
standardgbg opened this issue Mar 11, 2018 · 4 comments
Closed

Unhandled PID value, only SMS supported #53

standardgbg opened this issue Mar 11, 2018 · 4 comments

Comments

@standardgbg
Copy link

Hi!

First off I want to thank you for making this patched version of chan_dongle.
Its working great and I love it!
I've just found one problem with it and this is goes for all of the chan_dongle versions.

I have a E1750 setup to forward all incoming SMS with mail.
But it can't handle when the sender uses a alphabetical sender name instead of a number.

[2018-03-10 18:32:02] WARNING[27972]: at_response.c:1232 at_response_cmgr: [dongle0] Error parsing incoming message '+CMGR: 0,,124 **I HAVE REMOVED MY SMS PID_VALUE'** at position 53: Unhandled PID value, only SMS supported

There is similar bugs reported in the other versions of chan_dongle and some patch files are available but I can't get them to work in the version.
Any help would be appreciated :)

@wdoekes
Copy link
Owner

wdoekes commented Mar 12, 2018

I don't see you PID value, so I cannot comment on what it is, but looking on the internet I see for example this:
https://sourceforge.net/p/raspbx/discussion/bugreports/thread/55bc0a67/
where the pid value is 0x39 == 57

Which would be TP-PID 57 "SC-specific; usage based on mutual agreement between the SME and the SC"

https://en.m.wikipedia.org/wiki/GSM_03.40#Protocol_Identifier

SME = Short Messaging Entity
SC = Service Center

I suppose allowing anything below 128 would work without any changes.

Try this (compile tested only):

diff --git a/pdu.c b/pdu.c
index 9db8a48..55cbb13 100644
--- a/pdu.c
+++ b/pdu.c
@@ -761,9 +761,14 @@ EXPORT_DEF const char * pdu_parse(char ** pdu, size_t tpdu_length, char * oa, si
 		return "Can't parse PID";
 	}
 
-	/* TODO: support other types of messages */
 	if (pid != PDU_PID_SMS && !(0x41 <= pid && pid <= 0x47) /* PDU_PID_SMS_REPLACE_MASK */) {
-		return "Unhandled PID value, only SMS supported";
+		if (pid < 128) {
+			/* See: https://en.m.wikipedia.org/wiki/GSM_03.40#Protocol_Identifier
+			 * Not sure how to handle these, allow for now.. */
+			ast_debug(1, "Allowing TP-PID value 0x%hhx\n", (unsigned char)pid);
+		} else {
+			return "Unhandled PID value, only SMS supported";
+		}
 	}
 
 	dcs = pdu_parse_byte(pdu, &pdu_length);

@standardgbg
Copy link
Author

standardgbg commented Mar 12, 2018

Hi,

Sorry, but I removed the PID data for privacy reasons.
If i run it through a PDU decoder I get TP-PID: 39.
I will test and report back :)
Thanks!

EDIT:
I tested it and it works!
It doesn't decode the sender alphabetical name but it forwards the sender number instead of halting with an error. This is fully satisfactory for me!
My hat off for you and keep up the good work!

@wdoekes
Copy link
Owner

wdoekes commented Mar 12, 2018

Glad to help.

It doesn't decode the sender alphabetical name

That is a different problem. It's probably located somewhere near the parsing of TP-OA.

I'd still need (parts of) your censored data to try and fix that.

@standardgbg
Copy link
Author

Correction:
It's all working great!
The sender I used to test an alphabetical sender name started using a phone number for some reason. I tested another sender and its all working like a charm!
I'm happy. Again, thank you! 🥇

@wdoekes wdoekes changed the title Unhandled PID value, only SMS supported (Name as sender number) Unhandled PID value, only SMS supported Mar 12, 2018
shalzz pushed a commit to shalzz/asterisk-chan-dongle that referenced this issue Apr 23, 2022
# This is the 1st commit message:

Create DONATIONS.txt
# This is the commit message wdoekes#2:

Update README.md
# This is the commit message wdoekes#3:

Update DONATIONS.txt
# This is the commit message wdoekes#4:

Update DONATIONS.txt
# This is the commit message wdoekes#5:

Update DONATIONS.txt
# This is the commit message wdoekes#6:

Update chan_quectel.h
# This is the commit message wdoekes#7:

Update README.md
# This is the commit message wdoekes#8:

Update cpvt.h
# This is the commit message wdoekes#9:

Add files via upload
# This is the commit message wdoekes#10:

Delete DONATIONS.txt
# This is the commit message wdoekes#11:

Update README.md
# This is the commit message wdoekes#12:

Update README.md
# This is the commit message wdoekes#13:

Update README.md
# This is the commit message wdoekes#14:

Add files via upload
# This is the commit message wdoekes#15:

Update README.md
# This is the commit message wdoekes#16:

Update README.md
# This is the commit message wdoekes#17:

Update README.md
# This is the commit message wdoekes#18:

Update README.md
# This is the commit message wdoekes#19:

Update README.md
# This is the commit message wdoekes#20:

Update README.md
# This is the commit message wdoekes#21:

Update README.md
# This is the commit message wdoekes#22:

Update README.md
# This is the commit message wdoekes#23:

Add files via upload

Added Simcom support
# This is the commit message wdoekes#24:

Update README.md
# This is the commit message wdoekes#25:

Update README.md
# This is the commit message wdoekes#26:

Added support for Quectel UAC configuration
# This is the commit message wdoekes#27:

Conf file when using UAC
# This is the commit message wdoekes#28:

Update README.md
# This is the commit message wdoekes#29:

Update README.md
# This is the commit message wdoekes#30:

Quectel CREG correction

chan_dongle code assumes 4 parameters in response to command and 3 for URC. However quectel provides 5 and 4 respectively. This fix helps pass on correct status of registration.
# This is the commit message wdoekes#31:

No force registration status

Due to CREG parse issues, earlier registration status was always kept on, now will show unregistered if not connected to network
# This is the commit message wdoekes#32:

Create readme.md
# This is the commit message wdoekes#33:

For compilation with openwrt sdk
# This is the commit message wdoekes#34:

Support for openwrt sdk compilation
# This is the commit message wdoekes#35:

Fix for lac and cell id

Ref IchthysMaranatha#6
Post fix values may have a trailing double quote for quectel devices
# This is the commit message wdoekes#36:

Updated call ids for simcom

Add call termination for call ids 1 and 2
# This is the commit message wdoekes#37:

comment for simcom audio

Added default audio port for simcom in comment
# This is the commit message wdoekes#38:

Integrated ALSA support for UAC

Integrated driver for ALSA added, no need for bridging additional Asterisk ALSA channel when using UAC mode. Please use non-ALSA integrated branch if there is no need for UAC and you wish to avoid alsa dependency when compiling and running
# This is the commit message wdoekes#39:

Update COPYRIGHT.txt

Attribute copyright for alsa code copied from chan_alsa.c https://github.com/asterisk/asterisk/blob/master/channels/chan_alsa.c
# This is the commit message wdoekes#40:

Update README.md
# This is the commit message wdoekes#41:

Conf file with UAC device support
# This is the commit message wdoekes#42:

UAC mode conf file
# This is the commit message wdoekes#43:

Added alsa-lib for compilation
# This is the commit message wdoekes#44:

Delete Makefile.in
# This is the commit message wdoekes#45:

alsa-lib dependency addition
# This is the commit message wdoekes#46:

Fix for simcom audio issues with immediate answer in dialplan
# This is the commit message wdoekes#47:

Note for Quectel serial audio

Added remark to disable gps messages
# This is the commit message wdoekes#48:

Added note for Pi users
# This is the commit message wdoekes#49:

Quectel creg formatting fix

Removed trailing double quotes in reporting lac/cid
# This is the commit message wdoekes#50:

add gitattributes
# This is the commit message wdoekes#51:

Send DTMF using AT command

Corrected at command for dtmf generation
# This is the commit message wdoekes#52:

Fix for busy on call rejection for simcom

For those who receive 'busy' additionally on call rejection when dialling out. Author only receives 'no carrier' on rejection. Reported and solved by @mpmc here IchthysMaranatha#22
# This is the commit message wdoekes#53:

Removal of redundant closetty
# This is the commit message wdoekes#54:

Update busy fix for call rejection

Updated fix as submitted by @mpmc here IchthysMaranatha#22
Author does not receive busy response on call rejection
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants