*** wap_push_ppg.c	Thu Mar 20 12:27:18 2003
--- wap_push_ppg.c.patched	Thu Mar 20 12:31:17 2003
***************
*** 837,850 ****
              /* check if we have an explicit routing information */
              retos = http_cgi_variable(cgivars, "smsc");
              if (retos == NULL) {
!                 /* get the push user specific smsc routing */
!                 smsc_id = wap_push_ppg_pushuser_smsc_id_get(username);
!                 /* if there was no user specific, then set the ppg global */
!                 smsc_id = smsc_id ? 
                      smsc_id : (ppg_default_smsc ? octstr_duplicate(ppg_default_smsc) : NULL);
              } else {
                  smsc_id = octstr_duplicate(retos);
              }
              ppg_event->u.Push_Message.push_headers = 
                  http_header_duplicate(push_headers);
              ppg_event->u.Push_Message.push_data = octstr_duplicate(push_data);
--- 837,869 ----
              /* check if we have an explicit routing information */
              retos = http_cgi_variable(cgivars, "smsc");
              if (retos == NULL) {
! 
!             	/* No explicit routing specified in request */
! 
!             	/* If there's a user involved with this request, find smsc-id for this user, else */
!             	/* (no user involved) get the default smsc-id. */
! 
! 					if (username == NULL || (octstr_str_compare(username,"") == 0)) {
! 						/* No user associated with request, use default smsc-id */
! 						smsc_id = smsc_id ? 
                      smsc_id : (ppg_default_smsc ? octstr_duplicate(ppg_default_smsc) : NULL);
+ 
+                     if (smsc_id == NULL) {
+                     		debug("wap.push.ppg", 0, "PPG: no user associated with request, no default smsc-id");
+                     } else {
+                     		debug("wap.push.ppg", 0, "PPG: no user associated with request, using default smsc-id");
+                     }
+ 					} else {	
+ 						 /* get the push user specific smsc routing */
+ 						 smsc_id = wap_push_ppg_pushuser_smsc_id_get(username);
+ 						 /* if there was no user specific, then set the ppg global */
+ 						 smsc_id = smsc_id ? 
+ 							  smsc_id : (ppg_default_smsc ? octstr_duplicate(ppg_default_smsc) : NULL);
+                }
              } else {
                  smsc_id = octstr_duplicate(retos);
              }
+ 
              ppg_event->u.Push_Message.push_headers = 
                  http_header_duplicate(push_headers);
              ppg_event->u.Push_Message.push_data = octstr_duplicate(push_data);
