<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Yes, you have to edit the code in sdpops module if you want to
    expose a function from it for usage in another module.<br>
    <br>
    You can make a pull request on github project for your patch to
    sdpops module and if all is ok with it, will be merged as soon as
    master branch in unfrozen.<br>
    <br>
    Cheers,<br>
    Daniel<br>
    <br>
    <div class="moz-cite-prefix">On 08/05/15 23:35, Cockhootec Yahrabee
      wrote:<br>
    </div>
    <blockquote
cite="mid:CAJetf72gzugo04aZ+7+1XfcOTY9pc+xbHj6c1DUtA+3bdhAVQg@mail.gmail.com"
      type="cite">
      <div dir="ltr">Daniel, I am sorry I am really confused right now
        because I read your responses again and it seems that I need to
        edit code of sdpops module. Is that right? Or I can extend
        sdpops API from outside like in my module? Could you please be
        specific?
        <div><br>
        </div>
        <div>If I decide to extend sdpops API (right in the module - it
          seems to be pretty easy I just need to add function to
          structure and specify pointer to that function) should I
          commit it to kamailio/kamailio repository? Could you please
          send me some kind of link with guidelines for contributing?</div>
        <div><br>
        </div>
        <div>Thanks in advance </div>
      </div>
      <div class="gmail_extra"><br>
        <div class="gmail_quote">On Fri, May 8, 2015 at 5:58 PM,
          Cockhootec Yahrabee <span dir="ltr"><<a
              moz-do-not-send="true" href="mailto:cockootec@gmail.com"
              target="_blank">cockootec@gmail.com</a>></span> wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div dir="ltr">Thanks Daniel for quick response.
              <div>Could you please be more specific on how to extend
                "sdpops_api_t" structure?</div>
              <div><br>
              </div>
              <div>I've never done it so little help will be
                appreciated.</div>
              <div><br>
              </div>
            </div>
            <div class="HOEnZb">
              <div class="h5">
                <div class="gmail_extra"><br>
                  <div class="gmail_quote">On Fri, May 8, 2015 at 4:42
                    PM, Daniel-Constantin Mierla <span dir="ltr"><<a
                        moz-do-not-send="true"
                        href="mailto:miconda@gmail.com" target="_blank">miconda@gmail.com</a>></span>
                    wrote:<br>
                    <blockquote class="gmail_quote" style="margin:0 0 0
                      .8ex;border-left:1px #ccc solid;padding-left:1ex">
                      <div bgcolor="#FFFFFF" text="#000000"> On a quick
                        look, sdpops already exposes a function via api
                        -- see modules/sdpops/api.h. So most of the
                        needed things are there, you just need to extend
                        the sdpops_api_t structure and bind_sdpops(...)
                        function to set the new field to the function
                        pointer.<br>
                        <br>
                        Cheers,<br>
                        Daniel
                        <div>
                          <div><br>
                            <br>
                            <div>On 08/05/15 16:37, Daniel-Constantin
                              Mierla wrote:<br>
                            </div>
                            <blockquote type="cite"> Hello,<br>
                              <br>
                              practically you want to call a function
                              from another compiled object (like from a
                              library). The way to do it is to expose
                              the function you want via an API structure
                              and then bind to this module from your
                              module. This is quite common practice in
                              kamailio -- for example, a lot of modules
                              connect to tm module to use its functions.<br>
                              <br>
                              You can look at sl module how it exports
                              some of its functions (the structure
                              sl_api_t and the function sl_load_api) and
                              then at registrar module to see how it
                              bind and uses the api from sl module.<br>
                              <br>
                              Cheers,<br>
                              Daniel<br>
                              <br>
                              <div>On 08/05/15 16:07, Cockhootec
                                Yahrabee wrote:<br>
                              </div>
                              <blockquote type="cite">
                                <div dir="ltr">Hi guys,
                                  <div><br>
                                  </div>
                                  <div>I found this very useful function
                                    in `sdpops` module which I want to
                                    use within my own module but I
                                    cannot find out how to forward its
                                    declaration correctly so I can use
                                    it in my module.</div>
                                  <div><br>
                                  </div>
                                  <div>Since `sdpops` has not defined
                                    it's functions within .h file I am
                                    just simply forward declaring
                                    function I want to use in my .h file
                                    like this:</div>
                                  <font face="monospace, monospace"><br>
                                    int
                                    sdp_remove_codecs_by_name(sip_msg_t*
                                    msg, str* codecs);</font><br>
                                  <br>
                                  <div>And then I just calling it within
                                    my function. I can compile it and
                                    linker won't give me any errors but
                                    when I am running Kamailio it says
                                    that I have error in config file
                                    which is obviously not true because
                                    if I comment code which uses forward
                                    declared function kamailio runs
                                    without errors.</div>
                                  <div><br>
                                  </div>
                                  <div>Kamailio log (when using
                                    forwarded declaration of sdpops
                                    function):</div>
                                  <div>
                                    <div><font face="monospace,
                                        monospace"> 0(23096) DEBUG:
                                        <core>
                                        [route_struct.c:129]:
                                        mk_action(): ACTION_#2 #0/2:
                                        3(3)/ 0x1</font></div>
                                    <div><font face="monospace,
                                        monospace"> 0(23096) DEBUG:
                                        <core>
                                        [route_struct.c:129]:
                                        mk_action(): ACTION_#2 #1/2:
                                        3(3)/ 0x1</font></div>
                                    <div><font face="monospace,
                                        monospace"> 0(23096) DEBUG:
                                        <core>
                                        [route_struct.c:129]:
                                        mk_action(): ACTION_#16 #0/3:
                                        22(16)/ 0x7f115fcfa898</font></div>
                                    <div><font face="monospace,
                                        monospace"> 0(23096) DEBUG:
                                        <core>
                                        [route_struct.c:129]:
                                        mk_action(): ACTION_#16 #1/3:
                                        8(8)/ 0x7f115fcfaf98</font></div>
                                    <div><font face="monospace,
                                        monospace"> 0(23096) DEBUG:
                                        <core>
                                        [route_struct.c:129]:
                                        mk_action(): ACTION_#16 #2/3:
                                        0(0)/ 0x7f1100000000</font></div>
                                    <div><font face="monospace,
                                        monospace"> 0(23096) DEBUG:
                                        <core> [route.c:129]:
                                        route_add(): mapping routing
                                        block (0xa84a40)[MANAGE_FAILURE]
                                        to 1</font></div>
                                    <div><font face="monospace,
                                        monospace">ERROR: bad config
                                        file (1 errors)</font></div>
                                    <div><font face="monospace,
                                        monospace"> 0(23096) DEBUG:
                                        <core> [ppcfg.c:224]:
                                        pp_ifdef_level_check(): same
                                        number of pairing preprocessor
                                        directives #!IF[N]DEF - #!ENDIF</font></div>
                                    <div><font face="monospace,
                                        monospace"> 0(23096) DEBUG: tm
                                        [t_funcs.c:85]: tm_shutdown():
                                        DEBUG: tm_shutdown : start</font></div>
                                    <div><font face="monospace,
                                        monospace"> 0(23096) DEBUG: tm
                                        [t_funcs.c:88]: tm_shutdown():
                                        DEBUG: tm_shutdown : emptying
                                        hash table</font></div>
                                    <div><font face="monospace,
                                        monospace"> 0(23096) DEBUG: tm
                                        [t_funcs.c:90]: tm_shutdown():
                                        DEBUG: tm_shutdown : removing
                                        semaphores</font></div>
                                    <div><font face="monospace,
                                        monospace"> 0(23096) DEBUG: tm
                                        [t_funcs.c:92]: tm_shutdown():
                                        DEBUG: tm_shutdown : destroying
                                        tmcb lists</font></div>
                                    <div><font face="monospace,
                                        monospace"> 0(23096) DEBUG: tm
                                        [t_funcs.c:95]: tm_shutdown():
                                        DEBUG: tm_shutdown : done</font></div>
                                    <div><font face="monospace,
                                        monospace"> 0(23096) DEBUG:
                                        <core>
                                        [mem/shm_mem.c:242]:
                                        shm_mem_destroy():
                                        shm_mem_destroy</font></div>
                                    <div><font face="monospace,
                                        monospace"> 0(23096) DEBUG:
                                        <core>
                                        [mem/shm_mem.c:245]:
                                        shm_mem_destroy(): destroying
                                        the shared memory lock</font></div>
                                  </div>
                                  <div><br>
                                  </div>
                                  <div>Did anybody resolved this issue?
                                    All help is appreciated.</div>
                                </div>
                                <br>
                                <fieldset></fieldset>
                                <br>
                                <pre>_______________________________________________
sr-dev mailing list
<a moz-do-not-send="true" href="mailto:sr-dev@lists.sip-router.org" target="_blank">sr-dev@lists.sip-router.org</a>
<a moz-do-not-send="true" href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev" target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev</a>
</pre>
                              </blockquote>
                              <br>
                              <pre cols="72">-- 
Daniel-Constantin Mierla
<a moz-do-not-send="true" href="http://twitter.com/#%21/miconda" target="_blank">http://twitter.com/#!/miconda</a> - <a moz-do-not-send="true" href="http://www.linkedin.com/in/miconda" target="_blank">http://www.linkedin.com/in/miconda</a>
Kamailio World Conference, May 27-29, 2015
Berlin, Germany - <a moz-do-not-send="true" href="http://www.kamailioworld.com" target="_blank">http://www.kamailioworld.com</a></pre>
                            </blockquote>
                            <br>
                            <pre cols="72">-- 
Daniel-Constantin Mierla
<a moz-do-not-send="true" href="http://twitter.com/#%21/miconda" target="_blank">http://twitter.com/#!/miconda</a> - <a moz-do-not-send="true" href="http://www.linkedin.com/in/miconda" target="_blank">http://www.linkedin.com/in/miconda</a>
Kamailio World Conference, May 27-29, 2015
Berlin, Germany - <a moz-do-not-send="true" href="http://www.kamailioworld.com" target="_blank">http://www.kamailioworld.com</a></pre>
                          </div>
                        </div>
                      </div>
                      <br>
                      _______________________________________________<br>
                      sr-dev mailing list<br>
                      <a moz-do-not-send="true"
                        href="mailto:sr-dev@lists.sip-router.org"
                        target="_blank">sr-dev@lists.sip-router.org</a><br>
                      <a moz-do-not-send="true"
                        href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev"
                        target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev</a><br>
                      <br>
                    </blockquote>
                  </div>
                  <br>
                </div>
              </div>
            </div>
          </blockquote>
        </div>
        <br>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
sr-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:sr-dev@lists.sip-router.org">sr-dev@lists.sip-router.org</a>
<a class="moz-txt-link-freetext" href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev</a>
</pre>
    </blockquote>
    <br>
    <pre class="moz-signature" cols="72">-- 
Daniel-Constantin Mierla
<a class="moz-txt-link-freetext" href="http://twitter.com/#!/miconda">http://twitter.com/#!/miconda</a> - <a class="moz-txt-link-freetext" href="http://www.linkedin.com/in/miconda">http://www.linkedin.com/in/miconda</a>
Kamailio World Conference, May 27-29, 2015
Berlin, Germany - <a class="moz-txt-link-freetext" href="http://www.kamailioworld.com">http://www.kamailioworld.com</a></pre>
  </body>
</html>