From 4e11c5a0c72868d8a3012a628b36351eaf32472c Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Fri, 1 Apr 2011 14:59:18 +0200 Subject: [PATCH] ussd: Properly encode the processUnstructuredSS request --- GSMDriver.st | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/GSMDriver.st b/GSMDriver.st index 8f1f561..e7ba9a9 100644 --- a/GSMDriver.st +++ b/GSMDriver.st @@ -16,6 +16,8 @@ along with this program. If not, see . " +PackageLoader fileInPackage: #OsmoASN1. + Object subclass: GSMDriver [ | sccp proc sapis completeSem phoneConfig | @@ -362,11 +364,28 @@ ProcedureBase subclass: CallProcedure [ ProcedureBase subclass: USSDProcedure [ | nr | + + USSDProcedure class >> initWith: aConn phone: aPhone nr: aNr [ ^ (super initWith: aConn phone: aPhone) nr: aNr; yourself ] + USSDProcedure class >> buildProcessUnstructReq: aNr [ + | req str | + + req := {BERTag fromTuple: #(2 true 1). OrderedCollection + with: {BERTag integer. #(4).} + with: {BERTag integer. #(59).} + with: {BERTag fromTuple: #(0 true 16). OrderedCollection + with: {BERTag octetString. #(15).} + with: {BERTag octetString. aNr asUSSD7Bit.}.}.}. + + str := WriteStream on: (ByteArray new: 40). + (DERTLVStream on: str) nextPut: req. + ^ str contents + ] + nr: aNr [ nr := aNr. ] @@ -388,7 +407,7 @@ ProcedureBase subclass: USSDProcedure [ | reg | reg := GSM48SSRegister new. - reg facility data: #(16rA1 16r13 16r02 16r01 16r04 16r02 16r01 16r3B 16r30 16r0B 16r04 16r01 16r0F 16r04 16r06 16r2A 16rD5 16r4C 16r16 16r1B 16r01) asByteArray. + reg facility data: (self class buildProcessUnstructReq: nr). reg ssVersionOrDefault data: #(0). conn nextPutData: (BSSAPDTAP initWith: reg linkIdentifier: 0).