Commit 517105a6b1e1e5ccb2d940987693755d5dc16766
1 parent
4c33c17227
Exists in
master
epic
Showing 1 changed file with 9 additions and 0 deletions Side-by-side Diff
main.py
... | ... | @@ -85,6 +85,7 @@ def signalHandler(signum, frame): |
85 | 85 | TERMINATING = True |
86 | 86 | |
87 | 87 | def handleSms(sms): |
88 | + global CHIPINFO | |
88 | 89 | global DISABLE_SEM |
89 | 90 | global PRODUCTS |
90 | 91 | global LAST_PRODUCT |
... | ... | @@ -92,6 +93,12 @@ def handleSms(sms): |
92 | 93 | |
93 | 94 | logger.info(u'Incoming SMS from: {0}; Time: {1}; Message: {2}'.format(sms.number, sms.time, sms.text)) |
94 | 95 | |
96 | + try: | |
97 | + epic_key = 'epic.msgin.gw:' + BASE_CHIPINFO | |
98 | + redis_client.publish(epic_key + '.message', u'{0}: {1} ({2})'.format(sms.number, sms.text, CHIPINFO)) | |
99 | + except: | |
100 | + logger.warning('Fail to publish epic message to redis') | |
101 | + | |
95 | 102 | if not xltunai.isValidSender(sms.number): |
96 | 103 | logger.info('Ignoring incoming SMS from invalid sender') |
97 | 104 | return |
... | ... | @@ -166,6 +173,8 @@ def handleSms(sms): |
166 | 173 | |
167 | 174 | |
168 | 175 | def getRequestIdByNominalDestination(nominal, destination): |
176 | + global CHIPINFO | |
177 | + | |
169 | 178 | redis_key = sate24.keyByNominalDestination(CHIPINFO, nominal, destination) |
170 | 179 | #return redis_client.spop(redis_key) |
171 | 180 | return redis_client.rpop(redis_key) |