Forum OpenACS Q&A: Package Id

Collapse
Posted by Andrew Zeon on
Is there such thing as a package id?

I've got this procedure:


  ad_proc myapp_sms_send {
    p_package_id
    p_msisdn
    p_message
  } {
    Sends a text message with the given details.
  } {
    #
    # Convert the msisdn into international format (just in case its 
not).
    if {[string index $p_msisdn 0] == "0"} {
      set p_msisdn "+44[string range $p_msisdn 1 end]"
    }
    if {[string index $p_msisdn 0] != "+"} {
      set p_msisdn "+$p_msisdn"
    }
  
    #
    # Send the message
    smsq_submit_ascii [ad_parameter -package_id $p_package_id  
    outqueue] $p_msisdn $p_message
  }

How would I pass in the package id?

Thanks.

Collapse
2: Response to Package Id (response to 1)
Posted by Matthew Geddert on
you need to do this:
set p_package_id  [ad_conn package_id]
You can read about this kind of thing at https://openacs.org/doc/openacs-4/rp-design.html.
Collapse
3: Response to Package Id (response to 1)
Posted by Peter Harper on
Andrew, knowing a bit about your ongoing project and having written the above procedure, I think you can simplify the code here. This function was written so it could be called in relation to a number of mounted packages, hence the package_id parameter. You can see further down in the code it retrieves the SMS Broker queue name from the package's parameter. Your system is using only one queue, which is "out". You can safely remove the package_id parameter, and either hardcode (blah!) the "out" queue name, or pull it from a more appropriate configuration location.

Hope that helps.