Re: Unix Sockets in Go

mohsen khashei via sr-users <[email protected]>
Newsgroups gmane.comp.voip.ser
Message-ID <CALC6B6HsnzSqgP9ATnRMf_+J7Cwg3SAKywq_GUb=yjW55UwJXw@mail.gmail.com>
thanks for the reply I finally found an go library and it works perfectly i
put it here for anyone else maybe need it:

go-kamailio-binrpc <https://github.com/florentchauveau/go-kamailio-binrpc>

On Tue, Sep 23, 2025 at 5:44 AM Ruel Tmeizeh via sr-users <
[email protected]> wrote:

> Check here for an example client:
>
> https://github.com/cgrates/kamjsonrpc
>
> -Ruel
>
> Ruel Tmeizeh
> RuhNet Consulting
> https://ruhnet.co
>
>
> On Mon, 22 Sep 2025 20:36:00 +0330
> mohsen khashei via sr-users <[email protected]> wrote:
>
> > Hi I want to run rpc commands like permissions.addressReload from a go
> > application but with no luck please help me my code is:
> >
> >
> > cmd:="permissions.addressReload"
> > conn, err := net.Dial("unix", "/run/kamailio/kamailio_ctl")
> > if err != nil {
> > return "", fmt.Errorf("connect error: %w", err)
> > }
> > defer conn.Close()
> >
> > // _, err = fmt.Fprintf(conn, "%s\n", cmd)
> >  _, err = conn.Write([]byte(cmd))
> >  if err != nil {
> >      return "", fmt.Errorf("write error: %w", err)
> >  }
> >
> >  scanner := bufio.NewScanner(conn)
> >  var output string
> >  for scanner.Scan() {
> >      output += scanner.Text() + "\n"
> >  }
> >  if err := scanner.Err(); err != nil {
> >      return "", fmt.Errorf("read error: %w", err)
> >  }
> >
> > `
> > the only thing i get is:
> > ¡0#^@ ^A<90><91>^^bad request: corrupted packet^@
>
> __________________________________________________________
> Kamailio - Users Mailing List - Non Commercial Discussions --
> [email protected]
> To unsubscribe send an email to [email protected]
> Important: keep the mailing list in the recipients, do not reply only to
> the sender!
>

__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions -- [email protected]
To unsubscribe send an email to [email protected]
Important: keep the mailing list in the recipients, do not reply only to the sender!
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.