Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (Flatly)
  • No Skin
Collapse
Brand Logo

NetXMS Forum

  1. Home
  2. Support (Russian)
  3. websms - имя отправителя

websms - имя отправителя

Scheduled Pinned Locked Moved Support (Russian)
4 Posts 2 Posters 11.3k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H
    H
    Harun
    wrote on last edited by
    #1

    Понадобилось научить отправлять sms с именем отправителя, отличным от дефолтного. Вот патчик:

    diff -Npur netxms-2.0.2.old/src/server/smsdrv/websms/main.cpp netxms-2.0.2.new/src/server/smsdrv/websms/main.cpp
    --- netxms-2.0.2.old/src/server/smsdrv/websms/main.cpp	2015-08-29 21:43:58.000000000 +0300
    +++ netxms-2.0.2.new/src/server/smsdrv/websms/main.cpp	2016-02-12 08:38:02.000000000 +0300
    @@ -52,6 +52,7 @@ struct RequestData
      */
     static char s_login[128] = "user";
     static char s_password[128] = "password";
    +static char from_phone[16] = "";
    
     /**
      * Init driver
    @@ -87,9 +88,13 @@ extern "C" BOOL EXPORT SMSDriverInit(con
    
        ExtractNamedOptionValue(initArgs, _T("password"), buffer, 128);
        WideCharToMultiByte(CP_ACP, WC_DEFAULTCHAR | WC_COMPOSITECHECK, buffer, -1, s_password, 128, NULL, NULL);
    +
    +   ExtractNamedOptionValue(initArgs, _T("fromphone"), buffer, 16);
    +   WideCharToMultiByte(CP_ACP, WC_DEFAULTCHAR | WC_COMPOSITECHECK, buffer, -1, from_phone, 16, NULL, NULL);
     #else
        ExtractNamedOptionValue(initArgs, _T("login"), s_login, 128);
        ExtractNamedOptionValue(initArgs, _T("password"), s_password, 128);
    +   ExtractNamedOptionValue(initArgs, _T("fromphone"), from_phone, 16);
     #endif
    
     	return TRUE;
    @@ -156,7 +161,13 @@ extern "C" BOOL EXPORT SMSDriverSend(con
     #endif
    
           char url[4096];
    -      snprintf(url, 4096, "https://websms.ru/http_in5.asp?http_username=%s&http_password=%s&phone_list=%s&format=xml&message=%s", s_login, s_password, phone, msg);
    +      if (from_phone[0]==0x00)
    +      {
    +          snprintf(url, 4096, "https://websms.ru/http_in5.asp?http_username=%s&http_password=%s&phone_list=%s&format=xml&message=%s", s_login, s_password, phone, msg);
    +      } else
    +      {
    +          snprintf(url, 4096, "https://websms.ru/http_in5.asp?http_username=%s&http_password=%s&phone_list=%s&fromPhone=%s&format=xml&message=%s", s_login, s_password, phone, from_phone, msg);
    +      }
           DbgPrintf(4, _T("WebSMS: URL set to \"%hs\""), url);
    
           curl_free(phone);
    
    1 Reply Last reply
    0
    • V
      V
      Victor Kirhenshtein
      wrote on last edited by
      #2

      Спасибо, войдет в релиз 2.0.3.

      1 Reply Last reply
      0
      • H
        H
        Harun
        wrote on last edited by
        #3

        Поломался websms, зачем-то в api они поменяли URL, поправьте пожалуйста:

        @@ -161,7 +161,7 @@
         #endif
        
               char url[4096];
        -      snprintf(url, 4096, "https://websms.ru/http_in5.asp?http_username=%s&http_password=%s&phone_list=%s%s%s&format=xml&message=%s",
        +      snprintf(url, 4096, "https://cab.websms.ru/http_in5.asp?http_username=%s&http_password=%s&phone_list=%s%s%s&format=xml&message=%s",
                        s_login, s_password, phone, (s_fromPhone[0] != 0) ? "&fromPhone=" : "", (s_fromPhone[0] != 0) ? s_fromPhone : "", msg);
               nxlog_debug(4, _T("WebSMS: URL set to \"%hs\""), url)
        
        1 Reply Last reply
        0
        • V
          V
          Victor Kirhenshtein
          wrote on last edited by
          #4

          Поправил. Войдет в следующий релиз.

          1 Reply Last reply
          0

          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

          With your input, this post could be even better 💗

          Register Login
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          Powered by NodeBB Contributors
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups